<commit_before>/******************************************************************************\
* File:          server.cpp
* Purpose:       General socket server
* Author:        <NAME>
* RCS-ID:        $Id$
*
* Copyright (c) 2007-2009, <NAME>
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
\******************************************************************************/

#include <wx/aboutdlg.h>
#include <wx/numdlg.h>
#include <wx/extension/configdialog.h>
#include "server.h"

#ifndef __WXMSW__
#include "appl.xpm"
#ifdef USE_TASKBARICON
#include "connect.xpm"
#include "notready.xpm"
#include "ready.xpm"
#endif
#endif

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
  SetAppName("syncsocketserver");

  if (!wxExApp::OnInit())
  {
    return false;
  }

  MyFrame *frame = new MyFrame("syncsocketserver");
  SetTopWindow(frame);

  return true;
}

BEGIN_EVENT_TABLE(MyFrame, wxExFrameWithHistory)
  EVT_CLOSE(MyFrame::OnClose)
  EVT_MENU(wxID_ABOUT, MyFrame::OnCommand)
  EVT_MENU(wxID_EXECUTE, MyFrame::OnCommand)
  EVT_MENU(wxID_EXIT, MyFrame::OnCommand)
  EVT_MENU(wxID_NEW, MyFrame::OnCommand)
  EVT_MENU(wxID_OPEN, MyFrame::OnCommand)
  EVT_MENU(wxID_PREFERENCES, MyFrame::OnCommand)
  EVT_MENU(wxID_SAVE, MyFrame::OnCommand)
  EVT_MENU(wxID_SAVEAS, MyFrame::OnCommand)
  EVT_MENU(wxID_STOP, MyFrame::OnCommand)
  EVT_MENU(ID_SHELL_COMMAND, MyFrame::OnCommand)
  EVT_MENU_RANGE(ID_MENU_FIRST, ID_MENU_LAST, MyFrame::OnCommand)
  EVT_SOCKET(ID_SERVER, MyFrame::OnSocket)
  EVT_SOCKET(ID_CLIENT, MyFrame::OnSocket)
  EVT_TIMER(-1, MyFrame::OnTimer)
  EVT_UPDATE_UI(wxID_EXECUTE, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(wxID_SAVE, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(wxID_STOP, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLEAR_STATISTICS, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLIENT_ECHO, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLIENT_LOG_DATA, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLIENT_LOG_DATA_WITH_TIMESTAMP, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_RECENT_FILE_MENU, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_SERVER_CONFIG, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_TIMER_STOP, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_DATA, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_LOG, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_SHELL, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_STATISTICS, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_WRITE_DATA, MyFrame::OnUpdateUI)
END_EVENT_TABLE()

MyFrame::MyFrame(const wxString& title)
  : wxExFrameWithHistory(NULL, wxID_ANY, title)
  , m_Timer(this)
{
  SetIcon(wxICON(appl));

#ifdef USE_TASKBARICON<commit_msg>use menu range instead of single ones<commit_after>/******************************************************************************\
* File:          server.cpp
* Purpose:       General socket server
* Author:        <NAME>
* RCS-ID:        $Id$
*
* Copyright (c) 2007-2009, <NAME>
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
\******************************************************************************/

#include <wx/aboutdlg.h>
#include <wx/numdlg.h>
#include <wx/extension/configdialog.h>
#include "server.h"

#ifndef __WXMSW__
#include "appl.xpm"
#ifdef USE_TASKBARICON
#include "connect.xpm"
#include "notready.xpm"
#include "ready.xpm"
#endif
#endif

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
  SetAppName("syncsocketserver");

  if (!wxExApp::OnInit())
  {
    return false;
  }

  MyFrame *frame = new MyFrame("syncsocketserver");
  SetTopWindow(frame);

  return true;
}

BEGIN_EVENT_TABLE(MyFrame, wxExFrameWithHistory)
  EVT_CLOSE(MyFrame::OnClose)
  EVT_MENU_RANGE(wxID_LOWEST, wxID_HIGHEST, MyFrame::OnCommand)
  EVT_MENU(ID_SHELL_COMMAND, MyFrame::OnCommand)
  EVT_MENU_RANGE(ID_MENU_FIRST, ID_MENU_LAST, MyFrame::OnCommand)
  EVT_SOCKET(ID_SERVER, MyFrame::OnSocket)
  EVT_SOCKET(ID_CLIENT, MyFrame::OnSocket)
  EVT_TIMER(-1, MyFrame::OnTimer)
  EVT_UPDATE_UI(wxID_EXECUTE, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(wxID_SAVE, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(wxID_STOP, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLEAR_STATISTICS, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLIENT_ECHO, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLIENT_LOG_DATA, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_CLIENT_LOG_DATA_WITH_TIMESTAMP, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_RECENT_FILE_MENU, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_SERVER_CONFIG, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_TIMER_STOP, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_DATA, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_LOG, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_SHELL, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_VIEW_STATISTICS, MyFrame::OnUpdateUI)
  EVT_UPDATE_UI(ID_WRITE_DATA, MyFrame::OnUpdateUI)
END_EVENT_TABLE()

MyFrame::MyFrame(const wxString& title)
  : wxExFrameWithHistory(NULL, wxID_ANY, title)
  , m_Timer(this)
{
  SetIcon(wxICON(appl));

#ifdef USE_TASKBARICON
{'fraction_non_alphanumeric': 0.1688128772635815, 'fraction_numerical': 0.0036217303822937627, 'mean_word_length': 7.482935153583618, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2476913', 'n_tokens_mistral': 1973, 'n_tokens_neox': 1925, 'n_words': 278}