//------------------------------------------------------------------------------ // virtual void Create() //------------------------------------------------------------------------------ void RunScriptFolderDialog::Create() { #ifdef DEBUG_RUN_SCRIPT_FOLDER_DIALOG MessageInterface::ShowMessage(wxT("RunScriptFolderDialog::Create() entered.\n")); #endif int bsize = 1; //------------------------------------------------------ // save scripts //------------------------------------------------------ mRunFromSavedCheckBox = new wxCheckBox(this, ID_CHECKBOX, wxT(" Save scripts to new folder and run from it"), wxDefaultPosition, wxSize(-1, -1), 0); wxStaticText *saveScriptsDir = new wxStaticText(this, ID_TEXT, wxT("Directory to save scripts:"), wxDefaultPosition, wxDefaultSize, 0); mSaveScriptsDirTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(320,20), 0); mChangeSaveScriptsDirButton = new wxButton(this, ID_BUTTON, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0); wxBoxSizer *saveScriptsDirSizer = new wxBoxSizer(wxHORIZONTAL); saveScriptsDirSizer->Add(saveScriptsDir, 0, wxALIGN_CENTRE|wxALL, bsize); saveScriptsDirSizer->Add(mChangeSaveScriptsDirButton, 0, wxALIGN_CENTER|wxALL, bsize); wxBoxSizer *saveScriptsSizer = new wxBoxSizer(wxVERTICAL); saveScriptsSizer->Add(mRunFromSavedCheckBox, 0, wxALIGN_LEFT|wxALL, bsize); saveScriptsSizer->Add(saveScriptsDirSizer, 0, wxALIGN_LEFT|wxALL, bsize); saveScriptsSizer->Add(mSaveScriptsDirTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); //------------------------------------------------------ // run scripts //------------------------------------------------------ wxStaticText *startingScriptsLabel = new wxStaticText(this, ID_TEXT, wxT("Starting script number:"), wxDefaultPosition, wxDefaultSize, 0); mStartingScriptTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT("1"), wxDefaultPosition, wxSize(80,20), 0); wxStaticText *numScriptsLabel = new wxStaticText(this, ID_TEXT, wxT("Number of scripts to run:"), wxDefaultPosition, wxDefaultSize, 0); mNumScriptsToRunTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT("1"), wxDefaultPosition, wxSize(80,20), 0); wxStaticText *filterScriptsLabel = new wxStaticText(this, ID_TEXT, wxT("Run scripts contain:"), wxDefaultPosition, wxDefaultSize, 0); mFilterStringTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(80,20), 0); wxStaticText *numTimesLabel = new wxStaticText(this, ID_TEXT, wxT("Number of times to run each script:"), wxDefaultPosition, wxDefaultSize, 0); mCreateRunFolderCheckBox = new wxCheckBox(this, ID_CHECKBOX, wxT(" Create RUN folder"), wxDefaultPosition, wxSize(-1, -1), 0); mNumTimesToRunTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT("1"), wxDefaultPosition, wxSize(80,20), 0); wxStaticText *currOutDir1 = new wxStaticText(this, ID_TEXT, wxT("Current GMAT output directory:"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText *currOutDir2 = new wxStaticText(this, ID_TEXT, wxT("(ReportFile will use this path if ") wxT("it doesn't contain path)"), wxDefaultPosition, wxDefaultSize, 0); mCurrOutDirTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(320,20), 0); mChangeCurrOutDirButton = new wxButton(this, ID_BUTTON, wxT("Change for this Run"), wxDefaultPosition, wxDefaultSize, 0); //---------- sizer wxFlexGridSizer *runSizer = new wxFlexGridSizer(4, 0, 0); runSizer->Add(startingScriptsLabel, 0, wxALIGN_LEFT|wxALL, bsize); runSizer->Add(mStartingScriptTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(numScriptsLabel, 0, wxALIGN_LEFT|wxALL, bsize); runSizer->Add(mNumScriptsToRunTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(filterScriptsLabel, 0, wxALIGN_LEFT|wxALL, bsize); runSizer->Add(mFilterStringTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(numTimesLabel, 0, wxALIGN_LEFT|wxALL, bsize); runSizer->Add(mNumTimesToRunTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(5, 20, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runSizer->Add(mCreateRunFolderCheckBox, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); GmatStaticBoxSizer *runStaticSizer = new GmatStaticBoxSizer(wxVERTICAL, this, wxT("Run Scripts")); runStaticSizer->Add(saveScriptsSizer, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize); runStaticSizer->Add(20, 3, 0, wxALIGN_LEFT|wxALL, bsize); runStaticSizer->Add(runSizer, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize); runStaticSizer->Add(currOutDir1, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runStaticSizer->Add(currOutDir2, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runStaticSizer->Add(mCurrOutDirTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); runStaticSizer->Add(mChangeCurrOutDirButton, 0, wxALIGN_CENTER|wxALL, bsize); //================================================================= #ifdef __ENABLE_COMPARE__ //================================================================= //------------------------------------------------------ // compare results //------------------------------------------------------ mCompareCheckBox = new wxCheckBox(this, ID_CHECKBOX, wxT("Compare results"), wxDefaultPosition, wxSize(-1, -1), 0); wxStaticText *tolLabel = new wxStaticText(this, ID_TEXT, wxT("Tolerance to be used in flagging:"), wxDefaultPosition, wxDefaultSize, 0); mAbsTolTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT("1"), wxDefaultPosition, wxSize(80,20), 0); wxStaticText *replaceLabel = new wxStaticText(this, ID_TEXT, wxT("Compare files by replacing \"GMAT\" with:"), wxDefaultPosition, wxDefaultSize, 0); mReplaceTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT(mReplaceString), wxDefaultPosition, wxSize(80,20), 0); wxStaticText *compDirLabel = new wxStaticText(this, ID_TEXT, wxT("Directory to compare:"), wxDefaultPosition, wxDefaultSize, 0); //---------- sizer wxFlexGridSizer *compareSizer = new wxFlexGridSizer(2, 0, 0); compareSizer->Add(mCompareCheckBox, 0, wxALIGN_LEFT|wxALL, bsize); compareSizer->Add(20, 20, 0, wxALIGN_LEFT|wxALL, bsize); compareSizer->Add(tolLabel, 0, wxALIGN_LEFT|wxALL, bsize); compareSizer->Add(mAbsTolTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); compareSizer->Add(replaceLabel, 0, wxALIGN_LEFT|wxALL, bsize); compareSizer->Add(mReplaceTextCtrl, 0, wxALIGN_RIGHT|wxGROW|wxALL, bsize); mCompareDirTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(320,20), 0); mDirBrowseButton = new wxButton(this, ID_BUTTON, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0); mSaveResultCheckBox = new wxCheckBox(this, ID_CHECKBOX, wxT("Save compare results to file"), wxDefaultPosition, wxSize(-1, -1), 0); wxStaticText *saveFileLabel = new wxStaticText(this, ID_TEXT, wxT("Filename to save:"), wxDefaultPosition, wxDefaultSize, 0); mSaveFileTextCtrl = new wxTextCtrl(this, ID_TEXTCTRL, wxT(""), wxDefaultPosition, wxSize(320,20), 0); mSaveBrowseButton = new wxButton(this, ID_BUTTON, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0); GmatStaticBoxSizer *compareStaticSizer = new GmatStaticBoxSizer(wxVERTICAL, this, wxT("Compare Results")); wxBoxSizer *compDirSizer = new wxBoxSizer(wxHORIZONTAL); compDirSizer->Add(compDirLabel, 0, wxALIGN_CENTRE|wxGROW|wxALL, bsize); compDirSizer->Add(mDirBrowseButton, 0, wxALIGN_CENTRE|wxALL, bsize); wxBoxSizer *saveDirSizer = new wxBoxSizer(wxHORIZONTAL); saveDirSizer->Add(saveFileLabel, 0, wxALIGN_CENTRE|wxGROW|wxALL, bsize); saveDirSizer->Add(mSaveBrowseButton, 0, wxALIGN_CENTRE|wxALL, bsize); compareStaticSizer->Add(compareSizer, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize); compareStaticSizer->Add(compDirSizer, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize); compareStaticSizer->Add(mCompareDirTextCtrl, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize+2); compareStaticSizer->Add(20, 3, 0, wxALIGN_CENTRE|wxALL, bsize); compareStaticSizer->Add(mSaveResultCheckBox, 0, wxALIGN_LEFT|wxALL, bsize); compareStaticSizer->Add(saveDirSizer, 0, wxALIGN_LEFT|wxALL, bsize); compareStaticSizer->Add(mSaveFileTextCtrl, 0, wxALIGN_LEFT|wxGROW|wxALL, bsize+2); //================================================================= #endif //================================================================= //------------------------------------------------------ // add to page sizer //------------------------------------------------------ wxBoxSizer *pageBoxSizer = new wxBoxSizer(wxVERTICAL); pageBoxSizer->Add(runStaticSizer, 0, wxALIGN_CENTRE|wxGROW|wxALL, bsize); #ifdef __ENABLE_COMPARE__ pageBoxSizer->Add(compareStaticSizer, 0, wxALIGN_CENTRE|wxGROW|wxALL, bsize); #endif theMiddleSizer->Add(pageBoxSizer, 0, wxALIGN_CENTRE|wxALL, bsize); #ifdef DEBUG_RUN_SCRIPT_FOLDER_DIALOG MessageInterface::ShowMessage(wxT("RunScriptFolderDialog::Create() leaving.\n")); #endif }
wxSizer *ConfigDB( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 ); wxStaticText *item1 = new wxStaticText( parent, ID_TEXT, wxT("Username"), wxDefaultPosition, wxDefaultSize, 0 ); item0->Add( item1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item2 = new wxTextCtrl( parent, ID_CONFIG_DB_USER, wxT(""), wxDefaultPosition, wxSize(130,-1), 0 ); item0->Add( item2, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item3 = new wxStaticText( parent, ID_TEXT, wxT("Password"), wxDefaultPosition, wxDefaultSize, 0 ); item0->Add( item3, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item4 = new wxTextCtrl( parent, ID_CONFIG_DB_PWORD, wxT(""), wxDefaultPosition, wxSize(80,-1), wxTE_PASSWORD ); item0->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxString strs5[] = { wxT("ODBC"), wxT("ODBC (MySQL)") }; wxRadioBox *item5 = new wxRadioBox( parent, ID_CONFIG_DB_TYPE, wxT("Database"), wxDefaultPosition, wxDefaultSize, 2, strs5, 1, wxRA_SPECIFY_COLS ); item0->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item6 = new wxStaticText( parent, ID_TEXT, wxT("Driver"), wxDefaultPosition, wxDefaultSize, 0 ); item0->Add( item6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxFlexGridSizer *item7 = new wxFlexGridSizer( 3, 0, 0 ); wxTextCtrl *item8 = new wxTextCtrl( parent, ID_CONFIG_DB_DRIVER, wxT(""), wxDefaultPosition, wxSize(110,-1), 0 ); item7->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item9 = new wxButton( parent, ID_CONFIG_DB_BROWSE, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); item7->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item7, 0, wxALIGN_CENTER_VERTICAL, 5 ); wxStaticText *item10 = new wxStaticText( parent, ID_TEXT, wxT("Datasource"), wxDefaultPosition, wxDefaultSize, 0 ); item0->Add( item10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item11 = new wxTextCtrl( parent, ID_CONFIG_DB_DSN, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item0->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item12 = new wxStaticText( parent, ID_TEXT, wxT("Server"), wxDefaultPosition, wxDefaultSize, 0 ); item0->Add( item12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item13 = new wxTextCtrl( parent, ID_CONFIG_DB_SERVER, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item0->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item14 = new wxStaticText( parent, ID_TEXT, wxT("Port"), wxDefaultPosition, wxDefaultSize, 0 ); item0->Add( item14, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSpinCtrl *item15 = new wxSpinCtrl( parent, ID_CONFIG_DB_PORT, wxT("0"), wxDefaultPosition, wxSize(100,-1), wxSP_WRAP, 1, 64000, 0 ); item0->Add( item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
myFindReplaceDlg::myFindReplaceDlg (wxWindow *parent, const wxString &findstr, const wxString &replacestr, wxUint32 flags, long style) : wxScrollingDialog (parent, -1, _("Dialog"), wxDefaultPosition, wxDefaultSize, style | wxDEFAULT_DIALOG_STYLE) { m_style = 0; //accelerators (for help) const int nEntries = 1 ; wxAcceleratorEntry entries[nEntries]; entries[0].Set (wxACCEL_NORMAL, WXK_F1, wxID_HELP); wxAcceleratorTable accel (nEntries, entries); SetAcceleratorTable (accel); // layout the dialog m_findpane = new wxBoxSizer (wxVERTICAL); // find, replace text and options, direction wxBoxSizer *findsizer = new wxBoxSizer (wxHORIZONTAL); findsizer->Add (new wxStaticText (this, -1, _("Search for:"), wxDefaultPosition, wxSize(80, -1)), 0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6); m_findstr = new wxComboBox (this, myID_DLG_FIND_TEXT, findstr, wxDefaultPosition, wxSize(200, -1)); findsizer->Add (m_findstr, 1, wxALIGN_CENTRE_VERTICAL); m_findpane->Add (findsizer, 0, wxEXPAND | wxBOTTOM, 6); m_fdirsizer = new wxBoxSizer (wxHORIZONTAL); m_fdirsizer->Add (new wxStaticText (this, -1, _("In directories:"), wxDefaultPosition, wxSize(80, -1)), 0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6); wxString finddir; m_finddir = new wxComboBox (this, -1, finddir, wxDefaultPosition, wxSize(200, -1), //0, NULL); //AMD64 ambiguity betw int vs wxArray (int)0, (const wxString*) NULL); m_fdirsizer->Add (m_finddir, 1, wxALIGN_CENTRE_VERTICAL); m_findpane->Show (m_fdirsizer, false); m_findpane->Add (m_fdirsizer, 0, wxEXPAND | wxBOTTOM, 6); m_specsizer = new wxBoxSizer (wxHORIZONTAL); m_specsizer->Add (new wxStaticText (this, -1, _("With filespec:"), wxDefaultPosition, wxSize(80, -1)), 0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6); m_findspec = new wxTextCtrl (this, -1, wxEmptyString, wxDefaultPosition, wxSize(200, -1)); m_specsizer->Add (m_findspec, 1, wxALIGN_CENTRE_VERTICAL); m_findpane->Show (m_specsizer, false); m_findpane->Add (m_specsizer, 0, wxEXPAND | wxBOTTOM, 6); m_replsizer = new wxBoxSizer (wxHORIZONTAL); m_replsizer->Add (new wxStaticText (this, -1, _("Replace with:"), wxDefaultPosition, wxSize(80, -1)), 0, wxALIGN_CENTRE_VERTICAL | wxRIGHT, 6); m_replacestr = new wxComboBox (this, -1, replacestr, wxDefaultPosition, wxSize(200, -1)); m_replsizer->Add (m_replacestr, 1, wxALIGN_CENTRE_VERTICAL); m_findpane->Show (m_replsizer, false); m_findpane->Add (m_replsizer, 0, wxEXPAND | wxBOTTOM, 6); // options m_optionsizer = new wxBoxSizer (wxVERTICAL); m_matchcase = new wxCheckBox (this, -1, _("Match &case")); m_matchcase->SetValue ((flags & myFR_MATCHCASE) > 0); m_optionsizer->Add (m_matchcase, 0, wxBOTTOM, 6); m_wholeword = new wxCheckBox (this, -1, _("Whole &word")); m_wholeword->SetValue ((flags & myFR_WHOLEWORD) > 0); m_wholeword->Enable (false); m_optionsizer->Add (m_wholeword, 0, wxBOTTOM, 6); m_findregex = new wxCheckBox (this, -1, _("Regular &expression")); m_findregex->SetValue ((flags & myFR_FINDREGEX) > 0); m_optionsizer->Add (m_findregex, 0, wxBOTTOM, 6); m_subfolder = new wxCheckBox (this, -1, _("Sub &directories")); m_subfolder->SetValue ((flags & myFR_SUBFOLDER) > 0); m_optionsizer->Add (m_subfolder, 0); // directions m_dirssizer = new wxBoxSizer (wxVERTICAL); static const wxString directions[] = {_("&Upwards"), _("&Downwards")}; m_direction = new wxRadioBox (this, -1, _("Direction"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(directions), directions, 1, wxRA_SPECIFY_COLS); m_direction->SetSelection(1); m_dirssizer->Add (m_direction, 0); // options and directions m_optionpane = new wxBoxSizer (wxHORIZONTAL); m_optionpane->Add (m_optionsizer, 1, wxALIGN_TOP|wxALIGN_LEFT); m_optionpane->Add (m_dirssizer, 0, wxALIGN_TOP|wxALIGN_RIGHT); m_findpane->Add (0, 6); m_findpane->Add (m_optionpane, 0, wxEXPAND); // buttons m_buttonpane = new wxBoxSizer (wxVERTICAL); m_findButton = new wxButton (this, wxID_OK, _("&Find")); m_findButton->SetDefault(); m_buttonpane->Add (m_findButton, 0, wxEXPAND|wxALIGN_TOP|wxBOTTOM, 6); m_replaceButton = new wxButton (this, myID_REPLACE, _("&Replace")); m_buttonpane->Add (m_replaceButton, 0, wxEXPAND|wxALIGN_TOP|wxBOTTOM, 6); m_buttonpane->Show (m_replaceButton, false); m_replaceAllButton = new wxButton (this, myID_REPLACEALL, _("Replace &all")); m_buttonpane->Add (m_replaceAllButton, 0, wxEXPAND|wxALIGN_TOP|wxBOTTOM, 6); m_buttonpane->Show (m_replaceAllButton, false); m_cancelButton = new wxButton (this, wxID_CANCEL, _("Cancel")); m_buttonpane->Add (m_cancelButton, 0, wxEXPAND|wxALIGN_BOTTOM); m_totalpane = new wxBoxSizer (wxHORIZONTAL); m_totalpane->Add (m_findpane, 0, wxEXPAND | wxALL, 10); m_totalpane->Add (m_buttonpane, 0, wxEXPAND | wxALL, 10); m_findstr->SetFocus(); m_findstr->SetSelection (-1, -1); SetSizerAndFit (m_totalpane); // load history LoadDirHistory (); LoadFindHistory (); LoadReplaceHistory (); UpdateDirHistory (); UpdateFindHistory (); UpdateReplaceHistory (); }
wxSizer *Main( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); item0->AddGrowableCol( 0 ); item0->AddGrowableRow( 0 ); wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 ); item1->AddGrowableCol( 0 ); item1->AddGrowableCol( 1 ); item1->AddGrowableRow( 0 ); item1->AddGrowableRow( 4 ); wxWindow *item2 = parent->FindWindow( ID_MAIN_LOGO ); wxASSERT( item2 ); item1->Add( item2, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item3 = new wxButton( parent, ID_MAIN_CONFIG, wxT("Config"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item3, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 105 ); wxWindow *item4 = parent->FindWindow( ID_MAIN_INVENTORY ); wxASSERT( item4 ); item1->Add( item4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); wxWindow *item5 = parent->FindWindow( ID_MAIN_SALES ); wxASSERT( item5 ); item1->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 20 ); wxWindow *item6 = parent->FindWindow( ID_MAIN_CUSTOMER ); wxASSERT( item6 ); item1->Add( item6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); wxWindow *item7 = parent->FindWindow( ID_MAIN_REPORTS ); wxASSERT( item7 ); item1->Add( item7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 20 ); wxWindow *item8 = parent->FindWindow( ID_MAIN_EMPLOYEE ); wxASSERT( item8 ); item1->Add( item8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); wxWindow *item9 = parent->FindWindow( ID_MAIN_LOGOUT ); wxASSERT( item9 ); item1->Add( item9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 20 ); item0->Add( item1, 0, wxGROW|wxALL, 5 ); YardFooter *item10 = new YardFooter( parent, ID_PANEL, wxDefaultPosition, wxSize(200,90), 0 ); item0->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
wxSizer *NumberPad( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); item0->AddGrowableCol( 0 ); wxTextCtrl *item1 = new wxTextCtrl( parent, ID_CALC_SCREEN, wxT(""), wxDefaultPosition, wxSize(80,40), wxTE_READONLY ); item1->SetFont( wxFont( 22, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 ); wxFlexGridSizer *item3 = new wxFlexGridSizer( 3, 0, 0 ); wxButton *item4 = new wxButton( parent, ID_CALC_1, wxT("1"), wxDefaultPosition, wxSize(64,64), 0 ); item4->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item5 = new wxButton( parent, ID_CALC_2, wxT("2"), wxDefaultPosition, wxSize(64,64), 0 ); item5->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item6 = new wxButton( parent, ID_CALC_3, wxT("3"), wxDefaultPosition, wxSize(64,64), 0 ); item6->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item7 = new wxButton( parent, ID_CALC_4, wxT("4"), wxDefaultPosition, wxSize(64,64), 0 ); item7->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item8 = new wxButton( parent, ID_CALC_5, wxT("5"), wxDefaultPosition, wxSize(64,64), 0 ); item8->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item9 = new wxButton( parent, ID_CALC_6, wxT("6"), wxDefaultPosition, wxSize(64,64), 0 ); item9->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item10 = new wxButton( parent, ID_CALC_7, wxT("7"), wxDefaultPosition, wxSize(64,64), 0 ); item10->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item11 = new wxButton( parent, ID_CALC_8, wxT("8"), wxDefaultPosition, wxSize(64,64), 0 ); item11->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item12 = new wxButton( parent, ID_CALC_9, wxT("9"), wxDefaultPosition, wxSize(64,64), 0 ); item12->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item13 = new wxButton( parent, ID_CALC_CLEAR, wxT("C"), wxDefaultPosition, wxSize(50,64), 0 ); item13->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item14 = new wxButton( parent, ID_CALC_0, wxT("0"), wxDefaultPosition, wxSize(64,64), 0 ); item14->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); wxButton *item15 = new wxButton( parent, ID_CALC_DOT, wxT("."), wxDefaultPosition, wxSize(50,64), 0 ); item15->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item3->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( item3, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); wxFlexGridSizer *item16 = new wxFlexGridSizer( 1, 0, 0 ); wxButton *item17 = new wxButton( parent, ID_CALC_MULTIPLICATION, wxT("*"), wxDefaultPosition, wxSize(64,64), 0 ); item17->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item16->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item18 = new wxButton( parent, ID_CALC_DIVISION, wxT("/"), wxDefaultPosition, wxSize(64,64), 0 ); item18->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item19 = new wxButton( parent, ID_CALC_PLUS, wxT("+"), wxDefaultPosition, wxSize(64,64), 0 ); item19->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item16->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item20 = new wxButton( parent, ID_CALC_SUBTRACTION, wxT("-"), wxDefaultPosition, wxSize(64,64), 0 ); item20->SetFont( wxFont( 25, wxROMAN, wxNORMAL, wxNORMAL ) ); item16->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( item16, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); item0->Add( item2, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
void ModelInfoTab::populateTab() { SetSizer(new wxBoxSizer(wxVERTICAL)); // Create the list store that contains the eclass => count map _listStore = new wxutil::TreeModel(_columns, true); // Create the treeview and pack two columns into it _treeView = wxutil::TreeView::CreateWithModel(this, _listStore); _treeView->AppendTextColumn(_("Model"), _columns.model.getColumnIndex(), wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE); _treeView->AppendTextColumn(_("Polys"), _columns.polycount.getColumnIndex(), wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE); _treeView->AppendTextColumn(_("Count"), _columns.modelcount.getColumnIndex(), wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE); _treeView->AppendTextColumn(_("Skins"), _columns.skincount.getColumnIndex(), wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT, wxDATAVIEW_COL_SORTABLE); // Populate the liststore with the entity count information for (map::ModelBreakdown::Map::const_iterator i = _modelBreakdown.begin(); i != _modelBreakdown.end(); ++i) { wxutil::TreeModel::Row row = _listStore->AddItem(); row[_columns.model] = i->first; row[_columns.polycount] = static_cast<int>(i->second.polyCount); row[_columns.modelcount] = static_cast<int>(i->second.count); row[_columns.skincount] = static_cast<int>(i->second.skinCount.size()); row.SendItemAdded(); } // The table containing the primitive statistics wxGridSizer* table = new wxGridSizer(2, 2, 3, 6); wxStaticText* modelsLabel = new wxStaticText(this, wxID_ANY, _("Models used:")); wxStaticText* skinsLabel = new wxStaticText(this, wxID_ANY, _("Named Skins used:")); modelsLabel->SetMinSize(wxSize(100, -1)); skinsLabel->SetMinSize(wxSize(100, -1)); wxStaticText* modelCount = new wxStaticText(this, wxID_ANY, string::to_string(_modelBreakdown.getMap().size())); wxStaticText* skinCount = new wxStaticText(this, wxID_ANY, string::to_string(_modelBreakdown.getNumSkins())); modelCount->SetFont(modelCount->GetFont().Bold()); skinCount->SetFont(skinCount->GetFont().Bold()); table->Add(modelsLabel); table->Add(modelCount); table->Add(skinsLabel); table->Add(skinCount); GetSizer()->Add(_treeView, 1, wxEXPAND | wxALL, 12); GetSizer()->Add(table, 0, wxBOTTOM | wxLEFT | wxRIGHT, 12); }
wxSizer *MainText( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 ); item0->AddGrowableCol( 0 ); item0->AddGrowableCol( 1 ); item0->AddGrowableRow( 0 ); item0->AddGrowableRow( 1 ); item0->AddGrowableRow( 2 ); item0->AddGrowableRow( 3 ); wxButton *item1 = new wxButton( parent, ID_MAIN_INVENTORY, wxT("Inventory Management"), wxDefaultPosition, wxSize(265,35), 0 ); item1->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item1, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item2 = new wxButton( parent, ID_MAIN_SALES, wxT("Sales Cashier"), wxDefaultPosition, wxSize(265,35), 0 ); item2->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item3 = new wxButton( parent, ID_MAIN_CUSTOMER, wxT("Customer Information"), wxDefaultPosition, wxSize(265,35), 0 ); item3->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item3, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item4 = new wxButton( parent, ID_MAIN_REPORTS, wxT("Reports"), wxDefaultPosition, wxSize(265,35), 0 ); item4->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item5 = new wxButton( parent, ID_MAIN_EMPLOYEE, wxT("Employee Information"), wxDefaultPosition, wxSize(265,35), 0 ); item5->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item5, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item6 = new wxButton( parent, ID_MAIN_LOGOUT, wxT("Logout"), wxDefaultPosition, wxSize(265,35), 0 ); item6->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
RegisterEditorDialog::RegisterEditorDialog(wxPanel *parent, u32 _pc, cpu_thread* _cpu, CPUDisAsm* _disasm) : wxDialog(parent, wxID_ANY, "Edit registers") , pc(_pc) , cpu(_cpu) , disasm(_disasm) { wxBoxSizer* s_panel_margin_x = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s_panel_margin_y = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_panel = new wxBoxSizer(wxVERTICAL); wxBoxSizer* s_t1_panel = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s_t2_panel = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s_t3_panel = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* s_b_panel = new wxBoxSizer(wxHORIZONTAL); wxStaticText* t1_text = new wxStaticText(this, wxID_ANY, "Register: "); t1_register = new wxComboBox(this, wxID_ANY); wxStaticText* t2_text = new wxStaticText(this, wxID_ANY, "Value (Hex):"); t2_value = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, -1)); s_t1_panel->Add(t1_text); s_t1_panel->AddSpacer(8); s_t1_panel->Add(t1_register); s_t2_panel->Add(t2_text); s_t2_panel->AddSpacer(8); s_t2_panel->Add(t2_value); s_b_panel->Add(new wxButton(this, wxID_OK), wxLEFT, 0, 5); s_b_panel->AddSpacer(5); s_b_panel->Add(new wxButton(this, wxID_CANCEL), wxLEFT, 0, 5); s_panel->Add(s_t1_panel); s_panel->AddSpacer(8); s_panel->Add(s_t2_panel); s_panel->AddSpacer(16); s_panel->Add(s_b_panel); s_panel_margin_y->AddSpacer(12); s_panel_margin_y->Add(s_panel); s_panel_margin_y->AddSpacer(12); s_panel_margin_x->AddSpacer(12); s_panel_margin_x->Add(s_panel_margin_y); s_panel_margin_x->AddSpacer(12); Bind(wxEVT_COMBOBOX, &RegisterEditorDialog::updateRegister, this); switch (g_system) { case system_type::ps3: { if (_cpu->id >= ppu_thread::id_min) { for (int i = 0; i < 32; i++) t1_register->Append(wxString::Format("GPR[%d]", i)); for (int i = 0; i < 32; i++) t1_register->Append(wxString::Format("FPR[%d]", i)); for (int i = 0; i < 32; i++) t1_register->Append(wxString::Format("VR[%d]", i)); t1_register->Append("CR"); t1_register->Append("LR"); t1_register->Append("CTR"); //t1_register->Append("XER"); //t1_register->Append("FPSCR"); } else { for (int i = 0; i < 128; i++) t1_register->Append(wxString::Format("GPR[%d]", i)); } break; } default: wxMessageBox("Not supported thread.", "Error"); return; } SetSizerAndFit(s_panel_margin_x); if (ShowModal() == wxID_OK) { std::string reg = fmt::ToUTF8(t1_register->GetStringSelection()); std::string value = fmt::ToUTF8(t2_value->GetValue()); if (g_system == system_type::ps3 && cpu->id >= ppu_thread::id_min) { auto& ppu = *static_cast<ppu_thread*>(cpu); while (value.length() < 32) value = "0" + value; const auto first_brk = reg.find('['); try { if (first_brk != -1) { const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str()); if (reg.find("GPR") == 0 || reg.find("FPR") == 0) { const ullong reg_value = std::stoull(value.substr(16, 31), 0, 16); if (reg.find("GPR") == 0) ppu.gpr[reg_index] = (u64)reg_value; if (reg.find("FPR") == 0) (u64&)ppu.fpr[reg_index] = (u64)reg_value; return; } if (reg.find("VR") == 0) { const ullong reg_value0 = std::stoull(value.substr(16, 31), 0, 16); const ullong reg_value1 = std::stoull(value.substr(0, 15), 0, 16); ppu.vr[reg_index]._u64[0] = (u64)reg_value0; ppu.vr[reg_index]._u64[1] = (u64)reg_value1; return; } } if (reg == "LR" || reg == "CTR") { const ullong reg_value = std::stoull(value.substr(16, 31), 0, 16); if (reg == "LR") ppu.lr = (u64)reg_value; if (reg == "CTR") ppu.ctr = (u64)reg_value; return; } if (reg == "CR") { const ullong reg_value = std::stoull(value.substr(24, 31), 0, 16); if (reg == "CR") ppu.cr_unpack((u32)reg_value); return; } } catch (std::invalid_argument&) //if any of the stoull conversion fail { } } else if (g_system == system_type::ps3 && cpu->id < ppu_thread::id_min) { auto& spu = *static_cast<SPUThread*>(cpu); while (value.length() < 32) value = "0" + value; const auto first_brk = reg.find('['); try { if (first_brk != -1) { const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - 2).c_str()); if (reg.find("GPR") == 0) { const ullong reg_value0 = std::stoull(value.substr(16, 31), 0, 16); const ullong reg_value1 = std::stoull(value.substr(0, 15), 0, 16); spu.gpr[reg_index]._u64[0] = (u64)reg_value0; spu.gpr[reg_index]._u64[1] = (u64)reg_value1; return; } } } catch (std::invalid_argument&) { } } wxMessageBox("This value could not be converted.\nNo changes were made.", "Error"); } }
// Standard page sizes in mils, all constants // see: https://lists.launchpad.net/kicad-developers/msg07389.html // also see: wx/defs.h // local readability macro for millimeter wxSize #define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) ) // All MUST be defined as landscape. const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 ); const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 ); const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 ); const PAGE_INFO PAGE_INFO::pageA1( MMsize( 841, 594 ), wxT( "A1" ), PAPER_A1 ); const PAGE_INFO PAGE_INFO::pageA0( MMsize( 1189, 841 ), wxT( "A0" ), PAPER_A0 ); const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ), wxPAPER_LETTER ); const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ), wxPAPER_TABLOID ); const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ), wxPAPER_CSHEET ); const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ), wxPAPER_DSHEET ); const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ), wxPAPER_ESHEET ); const PAGE_INFO PAGE_INFO::pageGERBER( wxSize( 32000, 32000 ), wxT( "GERBER" ), wxPAPER_NONE ); const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom, wxPAPER_NONE ); // US paper sizes const PAGE_INFO PAGE_INFO::pageUSLetter( wxSize( 11000, 8500 ), wxT( "USLetter" ), wxPAPER_LETTER ); const PAGE_INFO PAGE_INFO::pageUSLegal( wxSize( 14000, 8500 ), wxT( "USLegal" ), wxPAPER_LEGAL ); const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedger" ), wxPAPER_TABLOID ); // Custom paper size for next instantiation of type "User" int PAGE_INFO::s_user_width = 17000;
bool wxGenericDirDialog::Create(wxWindow* parent, const wxString& title, const wxString& defaultPath, long style, const wxPoint& pos, const wxSize& sz, const wxString& name) { wxBusyCursor cursor; parent = GetParentForModalDialog(parent, style); if (!wxDirDialogBase::Create(parent, title, defaultPath, style, pos, sz, name)) return false; m_path = defaultPath; if (m_path == wxT("~")) wxGetHomeDir(&m_path); if (m_path == wxT(".")) m_path = wxGetCwd(); wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); // smartphones does not support or do not waste space for wxButtons #if defined(__SMARTPHONE__) wxMenu *dirMenu = new wxMenu; dirMenu->Append(ID_GO_HOME, _("Home")); if (!HasFlag(wxDD_DIR_MUST_EXIST)) { dirMenu->Append(ID_NEW, _("New directory")); } dirMenu->AppendCheckItem(ID_SHOW_HIDDEN, _("Show hidden directories")); dirMenu->AppendSeparator(); dirMenu->Append(wxID_CANCEL, _("Cancel")); #else // 0) 'New' and 'Home' Buttons wxSizer* buttonsizer = new wxBoxSizer( wxHORIZONTAL ); // VS: 'Home directory' concept is unknown to MS-DOS #if !defined(__DOS__) wxBitmapButton* homeButton = new wxBitmapButton(this, ID_GO_HOME, wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_BUTTON)); buttonsizer->Add( homeButton, 0, wxLEFT|wxRIGHT, 10 ); #endif // I'm not convinced we need a New button, and we tend to get annoying // accidental-editing with label editing enabled. if (!HasFlag(wxDD_DIR_MUST_EXIST)) { wxBitmapButton* newButton = new wxBitmapButton(this, ID_NEW, wxArtProvider::GetBitmap(wxART_NEW_DIR, wxART_BUTTON)); buttonsizer->Add( newButton, 0, wxRIGHT, 10 ); #if wxUSE_TOOLTIPS newButton->SetToolTip(_("Create new directory")); #endif } #if wxUSE_TOOLTIPS homeButton->SetToolTip(_("Go to home directory")); #endif topsizer->Add( buttonsizer, 0, wxTOP | wxALIGN_RIGHT, 10 ); #endif // __SMARTPHONE__/!__SMARTPHONE__ // 1) dir ctrl m_dirCtrl = NULL; // this is necessary, event handler called from // wxGenericDirCtrl would crash otherwise! long dirStyle = wxDIRCTRL_DIR_ONLY | wxDEFAULT_CONTROL_BORDER; #ifdef __WXMSW__ if (!HasFlag(wxDD_DIR_MUST_EXIST)) { // Only under Windows do we need the wxTR_EDIT_LABEL tree control style // before we can call EditLabel (required for "New directory") dirStyle |= wxDIRCTRL_EDIT_LABELS; } #endif m_dirCtrl = new wxGenericDirCtrl(this, ID_DIRCTRL, m_path, wxDefaultPosition, wxSize(300, 200), dirStyle); wxSizerFlags flagsBorder2; flagsBorder2.DoubleBorder(wxTOP | wxLEFT | wxRIGHT); topsizer->Add(m_dirCtrl, wxSizerFlags(flagsBorder2).Proportion(1).Expand()); #ifndef __SMARTPHONE__ // TODO: Make this an option depending on a flag? wxCheckBox * check = new wxCheckBox(this, ID_SHOW_HIDDEN, _("Show &hidden directories")); topsizer->Add(check, wxSizerFlags(flagsBorder2).Right()); #endif // !__SMARTPHONE__ // 2) text ctrl m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition ); topsizer->Add(m_input, wxSizerFlags(flagsBorder2).Expand()); // 3) buttons if any wxSizer *buttonSizer = CreateSeparatedButtonSizer(wxOK | wxCANCEL); if ( buttonSizer ) { topsizer->Add(buttonSizer, wxSizerFlags().Expand().DoubleBorder()); } #ifdef __SMARTPHONE__ // overwrite menu set by CreateSeparatedButtonSizer() call above SetRightMenu(wxID_ANY, _("Options"), dirMenu); #endif m_input->SetFocus(); SetAutoLayout( true ); SetSizer( topsizer ); topsizer->SetSizeHints( this ); topsizer->Fit( this ); Centre( wxBOTH ); return true; }
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, PART_LIB* aLibrary ) : SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType==FRAME_SCH_VIEWER ? KICAD_DEFAULT_DRAWFRAME_STYLE : KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT, GetLibViewerFrameName() ) { wxASSERT( aFrameType==FRAME_SCH_VIEWER || aFrameType==FRAME_SCH_VIEWER_MODAL ); if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); m_FrameName = GetLibViewerFrameName(); m_configPath = wxT( "LibraryViewer" ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) ); SetIcon( icon ); m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr; m_cmpList = NULL; m_libList = NULL; SetScreen( new SCH_SCREEN( aKiway ) ); GetScreen()->m_Center = true; // Axis origin centered on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Initialize grid id to the default value (50 mils): m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ReCreateHToolbar(); ReCreateVToolbar(); wxSize size = GetClientSize(); size.y -= m_MsgFrameHeight + 2; wxPoint win_pos( 0, 0 ); if( !aLibrary ) { // Creates the libraries window display m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxPoint( 0, 0 ), wxSize(m_libListWidth, -1), 0, NULL, wxLB_HSCROLL ); } else { m_libraryName = aLibrary->GetName(); m_entryName.Clear(); m_unit = 1; m_convert = 1; m_libListWidth = 0; } // Creates the component window display win_pos.x = m_libListWidth; m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ), wxSize(m_cmpListWidth, -1), 0, NULL, wxLB_HSCROLL ); if( m_libList ) ReCreateListLib(); DisplayLibInfos(); if( m_canvas ) m_canvas->SetAcceleratorTable( table ); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO info; info.InfoToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Manage main toolbal m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) ); // Manage the left window (list of libraries) if( m_libList ) m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ). Left().Row( 0 ) ); // Manage the list of components) m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( wxT( "m_cmpList" ) ). Left().Row( 1 ) ); // Manage the draw panel m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); // Manage the message panel m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); /* Now the minimum windows are fixed, set library list * and component list of the previous values from last viewlib use */ if( m_libList ) { m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_libList ).BestSize( wxSize(m_libListWidth, -1) ); } m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_cmpList ).BestSize(wxSize(m_cmpListWidth, -1) ); m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) #ifdef USE_WX_GRAPHICS_CONTEXT GetScreen()->SetZoom( BestZoom() ); #else Zoom_Automatique( false ); #endif Show( true ); }
MyFrame(wxWindow* parent) : wxFrame(parent, -1, _("Grid Test App"), wxDefaultPosition, wxSize(800,600), wxDEFAULT_FRAME_STYLE) , left_mouse_down_( false ) , middle_mouse_down_( false ) , right_mouse_down_( false ) , mouse_x_( 0 ) , mouse_y_( 0 ) { ogre_tools::initializeOgre(); ogre_tools::initializeResources( ogre_tools::V_string() ); root_ = Ogre::Root::getSingletonPtr(); try { scene_manager_ = root_->createSceneManager( Ogre::ST_GENERIC, "TestSceneManager" ); m_WXRenderWindow = new ogre_tools::wxOgreRenderWindow( root_, this ); m_WXRenderWindow->SetSize( this->GetSize() ); camera_ = new ogre_tools::OrbitCamera( scene_manager_ ); camera_->setPosition( 0, 0, 15 ); camera_->getOgreCamera()->setNearClipDistance( 0.1 ); m_WXRenderWindow->getViewport()->setCamera( camera_->getOgreCamera() ); ogre_tools::Grid* grid = new ogre_tools::Grid( scene_manager_, NULL, 10, 1.0f, 1.0f, 0.0f, 0.0f ); //grid->getSceneNode()->pitch( Ogre::Degree( 90 ) ); //ogre_tools::Axes* axes = new ogre_tools::Axes( scene_manager_ ); //axes->setScale( Ogre::Vector3( 2.0f, 2.0f, 2.0f ) ); /*ogre_tools::Cone* cone = new ogre_tools::Cone( scene_manager_, NULL ); cone->setScale( Ogre::Vector3( 0.3f, 2.0f, 0.3f ) );*/ /*ogre_tools::Arrow* arrow = new ogre_tools::Arrow( scene_manager_ ); arrow->SetHeadColor( 1.0f, 0.0f, 0.0f ); arrow->SetShaftColor( 0.0f, 0.0f, 1.0f ); arrow->setOrientation( Ogre::Quaternion::IDENTITY );*/ //arrow->setOrientation( Ogre::Quaternion( Ogre::Degree( 45 ), Ogre::Vector3::UNIT_X ) ); //arrow->setScale( Ogre::Vector3( 1.0f, 1.0f, 3.0f ) ); /*ogre_tools::PointCloud* pointCloud = new ogre_tools::PointCloud( scene_manager_ ); std::vector<ogre_tools::PointCloud::Point> points; points.resize( 1000000 ); for ( int32_t i = 0; i < 1000; ++i ) { for ( int32_t j = 0; j < 1000; ++j ) { ogre_tools::PointCloud::Point& point = points[ 1000*j + i ]; point.m_X = j / 10.0f; point.m_Y = i / 10.0f; point.m_Z = 0; point.r_ = abs(i) % 3 == 0 ? 1.0f : 0.0f; point.g_ = abs(i) % 3 == 1 ? 1.0f : 0.0f; point.b_ = abs(i) % 3 == 2 ? 1.0f : 0.0f; } } pointCloud->AddPoints( &points.front(), 1000000 );*/ ogre_tools::SuperEllipsoid* se = new ogre_tools::SuperEllipsoid( scene_manager_ ); se->create( ogre_tools::SuperEllipsoid::Cube, 60, Ogre::Vector3( 1.0f, 5.0f, 1.0f ) ); } catch ( Ogre::Exception& e ) { printf( "Fatal error: %s\n", e.what() ); exit(1); } m_WXRenderWindow->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_MOTION, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_MIDDLE_UP, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); m_WXRenderWindow->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( MyFrame::OnMouseEvents ), NULL, this ); }
// Construtor of JoystickConfiguration JoystickConfiguration::JoystickConfiguration(int pad, bool left, wxWindow *parent) : wxDialog( parent, // Parent wxID_ANY, // ID _T("Gamepad configuration"), // Title wxDefaultPosition, // Position wxSize(400, 200), // Width + Lenght // Style wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN) { m_init_reverse_Lx = false; m_init_reverse_Ly = false; m_init_reverse_Rx = false; m_init_reverse_Ry = false; m_init_mouse_Ljoy = false; m_init_mouse_Rjoy = false; m_pad_id = pad; m_isForLeftJoystick = left; m_pan_joystick_config = new wxPanel( this, // Parent wxID_ANY, // ID wxDefaultPosition, // Prosition wxSize(300, 200) // Size ); if (m_isForLeftJoystick) { m_cb_reverse_Lx = new wxCheckBox( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("Reverse Lx"), // Label wxPoint(20, 20) // Position ); m_cb_reverse_Ly = new wxCheckBox( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("Reverse Ly"), // Label wxPoint(20, 40) // Position ); m_cb_mouse_Ljoy = new wxCheckBox( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("Use mouse for left analog joystick"), // Label wxPoint(20, 60) // Position ); m_cb_reverse_Rx = nullptr; m_cb_reverse_Ry = nullptr; m_cb_mouse_Rjoy = nullptr; } else { m_cb_reverse_Rx = new wxCheckBox( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("Reverse Rx"), // Label wxPoint(20, 20) // Position ); m_cb_reverse_Ry = new wxCheckBox( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("Reverse Ry"), // Label wxPoint(20, 40) // Position ); m_cb_mouse_Rjoy = new wxCheckBox( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("Use mouse for right analog joystick"), // Label wxPoint(20, 60) // Position ); m_cb_reverse_Lx = nullptr; m_cb_reverse_Ly = nullptr; m_cb_mouse_Ljoy = nullptr; } m_bt_ok = new wxButton( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("&OK"), // Label wxPoint(250, 130), // Position wxSize(60, 25) // Size ); m_bt_cancel = new wxButton( m_pan_joystick_config, // Parent wxID_ANY, // ID _T("&Cancel"), // Label wxPoint(320, 130), // Position wxSize(60, 25) // Size ); Bind(wxEVT_BUTTON, &JoystickConfiguration::OnButtonClicked, this); Bind(wxEVT_CHECKBOX, &JoystickConfiguration::OnCheckboxChange, this); }
void CCodeView::OnPaint(wxPaintEvent& event) { // ------------------------- // General settings // ------------------------- wxPaintDC paint_dc(this); wxRect rc = GetClientRect(); int char_width; paint_dc.SetFont(DebuggerFont); { wxFontMetrics metrics = paint_dc.GetFontMetrics(); char_width = metrics.averageWidth; m_rowHeight = std::max(metrics.height, m_rowHeight); if (!DebuggerFont.IsFixedWidth()) char_width = paint_dc.GetTextExtent("mxx").GetWidth() / 3; // (1em + 2ex) / 3 } std::unique_ptr<wxGraphicsContext> ctx(wxGraphicsContext::Create(paint_dc)); ctx->DisableOffset(); // Incompatible with matrix transforms ctx->SetFont(DebuggerFont, *wxBLACK); struct Branch { int src, dst, srcAddr; }; Branch branches[256]; int num_branches = 0; const int num_rows = ((rc.height / m_rowHeight) / 2) + 2; const double scale = FromDIP(1024) / 1024.0; const int pen_width = static_cast<int>(std::ceil(scale)); const int col_width = rc.width - m_left_col_width; const int text_col = m_left_col_width + pen_width / 2 + 1; // 1 unscaled pixel const int bp_offset_x = FromDIP(LEFT_COL_WIDTH / 8); const wxSize bp_size = FromDIP(wxSize(LEFT_COL_WIDTH * 3 / 4, LEFT_COL_WIDTH * 3 / 4)); const int bp_offset_y = (m_rowHeight - bp_size.GetHeight()) / 2; // ------------ // ------------------------- // Colors and brushes // ------------------------- wxColour branch_color = wxTheColourDatabase->Find("PURPLE"); wxColour blr_color = wxTheColourDatabase->Find("DARK GREEN"); wxColour instr_color = wxTheColourDatabase->Find("VIOLET"); wxGraphicsPen null_pen = ctx->CreatePen(*wxTRANSPARENT_PEN); wxGraphicsPen focus_pen = ctx->CreatePen(wxPen(*wxBLACK, pen_width)); wxGraphicsPen selection_pen = ctx->CreatePen(wxPen("GREY", pen_width)); wxGraphicsBrush pc_brush = ctx->CreateBrush(*wxGREEN_BRUSH); wxGraphicsBrush bp_brush = ctx->CreateBrush(*wxRED_BRUSH); wxGraphicsBrush back_brush = ctx->CreateBrush(*wxWHITE_BRUSH); wxGraphicsBrush null_brush = ctx->CreateBrush(*wxTRANSPARENT_BRUSH); // ------------ // ----------------------------- // Walk through all visible rows // ----------------------------- for (int i = -num_rows; i <= num_rows; i++) { unsigned int address = m_curAddress + (i * m_align); int row_y = (rc.height / 2) + (m_rowHeight * i) - (m_rowHeight / 2); wxString temp = wxString::Format("%08x", address); u32 color = m_debugger->GetColor(address); wxBrush row_brush(wxColour(color >> 16, color >> 8, color)); ctx->SetBrush(back_brush); ctx->SetPen(null_pen); ctx->DrawRectangle(0, row_y, m_left_col_width, m_rowHeight); if (address == m_debugger->GetPC()) ctx->SetBrush(pc_brush); else ctx->SetBrush(row_brush); ctx->SetPen(null_pen); ctx->DrawRectangle(m_left_col_width, row_y, col_width, m_rowHeight); if (i == 0 || (m_selecting && address == m_selection)) { if (m_selecting && address == m_selection) ctx->SetPen(selection_pen); else ctx->SetPen(focus_pen); ctx->SetBrush(null_brush); // In a graphics context, the border of a rectangle is drawn along the edge, // it does not count towards the width of the rectangle (i.e. drawn right on // the pixel boundary of the fill area, half inside, half outside. For example // a rect with a 1px pen at (5,5)->(10,10) will have an actual screen size of // (4.5,4.5)->(10.5,10.5) with the line being aliased on the half-pixels) double offset = pen_width / 2.0; ctx->DrawRectangle(m_left_col_width + offset, row_y + offset, col_width - pen_width, m_rowHeight - pen_width); } if (!m_plain) { // the address text is dark red ctx->SetFont(DebuggerFont, wxColour(0x60, 0x00, 0x00)); ctx->DrawText(temp, text_col, row_y); ctx->SetFont(DebuggerFont, *wxBLACK); } // If running if (m_debugger->IsAlive()) { std::vector<std::string> dis = SplitString(m_debugger->Disassemble(address), '\t'); dis.resize(2); static const size_t VALID_BRANCH_LENGTH = 10; const std::string& opcode = dis[0]; const std::string& operands = dis[1]; std::string desc; // look for hex strings to decode branches std::string hex_str; size_t pos = operands.find("0x"); if (pos != std::string::npos) { hex_str = operands.substr(pos); } if (hex_str.length() == VALID_BRANCH_LENGTH) { u32 offs = std::stoul(hex_str, nullptr, 16); branches[num_branches].src = row_y + (m_rowHeight / 2); branches[num_branches].srcAddr = (address / m_align); branches[num_branches++].dst = (int)(row_y + ((s64)(u32)offs - (s64)(u32)address) * m_rowHeight / m_align + m_rowHeight / 2); desc = StringFromFormat("-->%s", m_debugger->GetDescription(offs).c_str()); // the -> arrow illustrations are purple ctx->SetFont(DebuggerFont, branch_color); } else { ctx->SetFont(DebuggerFont, *wxBLACK); } ctx->DrawText(StrToWxStr(operands), text_col + 17 * char_width, row_y); // ------------ // Show blr as its' own color if (opcode == "blr") ctx->SetFont(DebuggerFont, blr_color); else ctx->SetFont(DebuggerFont, instr_color); ctx->DrawText(StrToWxStr(opcode), text_col + (m_plain ? 1 * char_width : 9 * char_width), row_y); if (desc.empty()) { desc = m_debugger->GetDescription(address); } if (!m_plain) { ctx->SetFont(DebuggerFont, *wxBLUE); // char temp[256]; // UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE); if (!desc.empty()) { ctx->DrawText(StrToWxStr(desc), text_col + 44 * char_width, row_y); } } // Show red breakpoint dot if (m_debugger->IsBreakpoint(address)) { ctx->SetPen(null_pen); ctx->SetBrush(bp_brush); ctx->DrawEllipse(bp_offset_x, row_y + bp_offset_y, bp_size.GetWidth(), bp_size.GetHeight()); } } } // end of for // ------------ // ------------------------- // Colors and brushes // ------------------------- ctx->SetPen(focus_pen); wxGraphicsPath branch_path = ctx->CreatePath(); for (int i = 0; i < num_branches; ++i) { int x = text_col + 60 * char_width + (branches[i].srcAddr % 9) * 8; branch_path.MoveToPoint(x - 2 * scale, branches[i].src); if (branches[i].dst < rc.height + 400 && branches[i].dst > -400) { branch_path.AddLineToPoint(x + 2 * scale, branches[i].src); branch_path.AddLineToPoint(x + 2 * scale, branches[i].dst); branch_path.AddLineToPoint(x - 4 * scale, branches[i].dst); branch_path.MoveToPoint(x, branches[i].dst - 4 * scale); branch_path.AddLineToPoint(x - 4 * scale, branches[i].dst); branch_path.AddLineToPoint(x + 1 * scale, branches[i].dst + 5 * scale); } // else //{ // This can be re-enabled when there is a scrollbar or // something on the codeview (the lines are too long) // LineTo(ctx, x+4, branches[i].src); // MoveTo(x+2, branches[i].dst-4); // LineTo(ctx, x+6, branches[i].dst); // LineTo(ctx, x+1, branches[i].dst+5); //} // LineTo(ctx, x, branches[i].dst+4); // LineTo(ctx, x-2, branches[i].dst); } // If the pen width is odd then we need to offset the path so that lines are drawn in // the middle of pixels instead of the edge so we don't get aliasing. if (pen_width & 1) { wxGraphicsMatrix matrix = ctx->CreateMatrix(); matrix.Translate(0.5, 0.5); branch_path.Transform(matrix); } ctx->StrokePath(branch_path); // ------------ }
// The `main program' equivalent, creating the windows and returning the // main frame bool AudacityApp::OnInit() { // mChecker = new wxSingleInstanceChecker(GetAppName()); ::wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); #ifdef __WXMSW__ //BG: On Windows, associate the aup file type with Audacity { wxRegKey associateFileTypes; associateFileTypes.SetName("HKCR\\.AUP"); associateFileTypes.Create(true); associateFileTypes = "Audacity.Project"; associateFileTypes.SetName("HKCR\\Audacity.Project"); associateFileTypes.Create(true); associateFileTypes = "Audacity Project File"; associateFileTypes.SetName("HKCR\\Audacity.Project\\shell"); associateFileTypes.Create(true); associateFileTypes = ""; associateFileTypes.SetName("HKCR\\Audacity.Project\\shell\\open"); associateFileTypes.Create(true); associateFileTypes.SetName("HKCR\\Audacity.Project\\shell\\open\\command"); associateFileTypes.Create(true); associateFileTypes = (wxString)argv[0] + (wxString)" %1"; } #endif InitPreferences(); InitAudioIO(); // Locale // wxWindows 2.3 has a much nicer wxLocale API. We can make this code much // better once we move to wx 2.3/2.4. wxString lang = gPrefs->Read("/Locale/Language", "en"); if (lang != "en") { wxLogNull nolog; mLocale = new wxLocale("", lang, "", true, true); mLocale->AddCatalog("audacity"); } else mLocale = NULL; LoadEffects(wxPathOnly(argv[0])); #ifdef __WXMAC__ // Install AppleEvent handlers (allows us to open documents // that are dragged to our application's icon) AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(AEOpenFiles), 0, 0); AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP(AEQuit), 0, 0); // On the Mac, users don't expect a program to quit when you close the last window. // Create an offscreen frame with a menu bar. The frame should never // be visible, but when all other windows are closed, this menu bar should // become visible. gParentFrame = new wxFrame(NULL, -1, "invisible", wxPoint(5000, 5000), wxSize(100, 100)); wxMenu *fileMenu = new wxMenu(); fileMenu->Append(NewID, "&New\tCtrl+N"); fileMenu->Append(OpenID, "&Open...\tCtrl+O"); fileMenu->AppendSeparator(); fileMenu->Append(PreferencesID, "&Preferences...\tCtrl+P"); fileMenu->AppendSeparator(); fileMenu->Append(ExitID, "Quit\tCtrl+Q"); wxMenu *helpMenu = new wxMenu(); helpMenu->Append(AboutID, "About Audacity..."); wxApp::s_macAboutMenuItemId = AboutID; wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, "&File"); menuBar->Append(helpMenu, "&Help"); gParentFrame->SetMenuBar(menuBar); gParentFrame->Show(); SetTopWindow(gParentFrame); #endif SetExitOnFrameDelete(true); //Initiate pointers to toolbars here, and create //the toolbars that should be loaded at startup. //Initiate globally-held toolbar stubs here. gControlToolBarStub = new ToolBarStub(gParentWindow, ControlToolBarID); // Changing the following to NULL will make the application // load without the toolbar in memory at all. bool editToolBar; gPrefs->Read("/GUI/EnableEditToolBar", &editToolBar, true); if(editToolBar) gEditToolBarStub = new ToolBarStub(gParentWindow, EditToolBarID); else gEditToolBarStub = NULL; InitFreqWindow(gParentWindow); AudacityProject *project = CreateNewAudacityProject(gParentWindow); SetTopWindow(project); // Can't handle command-line args on Mac OS X yet... #ifndef __MACOSX__ // Parse command-line arguments if (argc > 1) { for (int option = 1; option < argc; option++) { if (!argv[option]) continue; bool handled = false; if (!wxString("-help").CmpNoCase(argv[option])) { printf(_("Command-line options supported:\n" " -help (this message)\n" " -test (run self diagnostics)\n" " -blocksize ### (set max disk block size in bytes)\n" "\n" "In addition, specify the name of an audio file or " "Audacity project\n" "to open it.\n" "\n")); exit(0); } if (option < argc - 1 && argv[option + 1] && !wxString("-blocksize").CmpNoCase(argv[option])) { long theBlockSize; if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { if (theBlockSize >= 256 && theBlockSize < 100000000) { fprintf(stderr, _("Using block size of %ld\n"), theBlockSize); Sequence::SetMaxDiskBlockSize(theBlockSize); } } option++; handled = true; } if (!handled && !wxString("-test").CmpNoCase(argv[option])) { RunBenchmark(NULL); exit(0); } if (argv[option][0] == '-' && !handled) { printf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } if (!handled) project->OpenFile(argv[option]); } // for option... } // if (argc>1) #endif // not Mac OS X return TRUE; }
ConflictListDialog::ConflictListDialog(wxWindow* parent, const std::vector<std::string>& files) : ExtDialog(parent, -1, _("TortoiseCVS - Resolve Conflicts"), wxDefaultPosition, wxDefaultSize, wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE | wxCLIP_CHILDREN) { TDEBUG_ENTER("ConflictListDialog::ConflictListDialog"); SetIcon(wxIcon(wxT("A_TORTOISE"), wxBITMAP_TYPE_ICO_RESOURCE)); std::vector<ItemData*> itemData; std::vector<std::string> tmp; std::vector<std::string>::const_iterator it; // Add files it = files.begin(); while (it != files.end()) { ItemData *data = new ItemData(); data->m_Filename = *it; data->m_Status = CVSStatus::STATUS_CONFLICT; itemData.push_back(data); tmp.push_back(*it); it++; } // Trim paths to sensible length ShortenPaths(tmp, myStub); wxStaticText* label2 = new ExtStaticText(this, -1, _( "CVS encountered conflicts when trying to merge your changes in the files below. Please merge your changes manually."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(60, 15))); FilenameText* label1 = new FilenameText(this, -1, _("Folder: %s"), wxText(RemoveTrailingDelimiter(myStub))); label1->SetWindowStyle(label1->GetWindowStyle() | wxST_NO_AUTORESIZE); myFiles = new ExtListCtrl(this, CONFLICTLISTDLG_ID_FILES, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_ALIGN_LEFT); myFiles->PushEventHandler(new ListCtrlEventHandler(this)); myFiles->InsertColumn(0, _("Filename"), wxLIST_FORMAT_LEFT, 0); myFiles->InsertColumn(1, _("Format"), wxLIST_FORMAT_LEFT, 0); myFiles->InsertColumn(2, _("Status"), wxLIST_FORMAT_LEFT, 0); AddFiles(tmp, itemData); myFiles->SetBestColumnWidth(0); myFiles->SetBestColumnWidth(1); myFiles->SetBestColumnWidth(2); myFiles->SetBestSize(wxDLG_UNIT(this, wxSize(150, 150)), wxDefaultSize); wxStaticText* tip = new wxStaticText(this, -1, _("To resolve the conflicts, double or right click on the files above.")); tip->SetForegroundColour(SetForegroundColour(ColorRefToWxColour(GetIntegerPreference("Colour Tip Text")))); // OK/Cancel button wxBoxSizer* sizerConfirm = new wxBoxSizer(wxHORIZONTAL); myOK = new wxButton(this, wxID_OK, _("Close")); myOK->SetDefault(); sizerConfirm->Add(myOK, 0, wxGROW | wxALL, 5); // Status bar myStatusBar = new wxStatusBar(this, -1); myStatusBar->SetStatusText(Printf(_("%d file(s)"), files.size()).c_str()); // Main box with everything in it wxBoxSizer* sizerTop = new wxBoxSizer(wxVERTICAL); sizerTop->Add(label2, 0, wxGROW | wxALL, 3); sizerTop->Add(label1, 0, wxGROW | wxALL, 3); sizerTop->Add(myFiles, 2, wxGROW | wxALL, 3); sizerTop->Add(tip, 0, wxALIGN_LEFT | wxALL, 3); sizerTop->Add(sizerConfirm, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 10); sizerTop->Add(myStatusBar, 0, wxGROW | wxALL, 0); // Overall dialog layout settings SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->SetSizeHints(this); sizerTop->Fit(this); RestoreTortoiseDialogSize(this, "Conflict"); SetTortoiseDialogPos(this, GetRemoteHandle()); RestoreTortoiseDialogState(this, "Conflict"); }
void ecPlatformEditorDialog::CreateControls(wxWindow* parent) { wxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxSizer *item1 = new wxFlexGridSizer( 2, 0, 0 ); wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, _("Platform &name:"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item3 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_NAME, _(""), wxDefaultPosition, wxSize(240,-1), 0 ); item1->Add( item3, 0, wxGROW|wxALL, 5 ); wxStaticText *item4 = new wxStaticText( parent, wxID_STATIC, _("Command &prefix:"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString *strs5 = (wxString*) NULL; wxComboBox *item5 = new wxComboBox( parent, ecID_MODIFY_PLATFORM_PREFIX, "", wxDefaultPosition, wxDefaultSize, 0, strs5, wxCB_DROPDOWN ); item1->Add( item5, 0, wxGROW|wxALL, 5 ); wxStaticText *item6 = new wxStaticText( parent, wxID_STATIC, _("Arguments for &GDB:"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item6, 0, wxALL, 5 ); wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_ARGS, _(""), wxDefaultPosition, wxSize(-1,140), wxTE_MULTILINE ); item1->Add( item7, 0, wxGROW|wxALL, 5 ); wxStaticText *item8 = new wxStaticText( parent, wxID_STATIC, _("Inferior:"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item9 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_INFERIOR, _(""), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item9, 0, wxGROW|wxALL, 5 ); wxStaticText *item10 = new wxStaticText( parent, wxID_STATIC, _("Prompt:"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item11 = new wxTextCtrl( parent, ecID_MODIFY_PLATFORM_PROMPT, _(""), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item11, 0, wxGROW|wxALL, 5 ); #if USE_SS_GDB_CONTROL item1->Add( 20, 20, 0, wxALIGN_CENTRE|wxALL, 5 ); wxCheckBox *item12 = new wxCheckBox( parent, ecID_MODIFY_PLATFORM_SS_GDB, _("Server-side GDB"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item12, 0, wxGROW|wxALL, 5 ); #endif item0->Add( item1, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSizer *item13 = new wxBoxSizer( wxHORIZONTAL ); wxButton *item14 = new wxButton( parent, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); item14->SetDefault(); item13->Add( item14, 0, wxALIGN_CENTRE|wxALL, 5 ); wxButton *item15 = new wxButton( parent, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); item13->Add( item15, 0, wxALIGN_CENTRE|wxALL, 5 ); #ifdef __WXGTK__ wxButton *contextButton = new wxContextHelpButton( parent ); item13->Add( contextButton, 0, wxALIGN_CENTRE|wxALL, 5 ); #endif item0->Add( item13, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); // Can't do this from wxDesigner :-( ((wxFlexGridSizer*)item1)->AddGrowableCol(1); ((wxFlexGridSizer*)item1)->AddGrowableRow(2); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); parent->Layout(); item0->Fit( parent ); item0->SetSizeHints( parent ); item3->SetFocus(); item14->SetDefault(); // Add context-sensitive help text parent->FindWindow( ecID_MODIFY_PLATFORM_NAME )->SetHelpText(_("Specifies the name of the platform. Platform names are arbitrary strings, but must be unique for a given user.")); parent->FindWindow( ecID_MODIFY_PLATFORM_PREFIX )->SetHelpText(_("Specifies the prefix to be used when invoking tools (for example, 'arm-elf' is the correct prefix if the appropriate gdb executable is arm-elf-gdb).")); parent->FindWindow( ecID_MODIFY_PLATFORM_ARGS )->SetHelpText(_("Specifies any additional arguments to be used when invoking gdb.")); parent->FindWindow( ecID_MODIFY_PLATFORM_INFERIOR )->SetHelpText(_("The gdb command to run.")); parent->FindWindow( ecID_MODIFY_PLATFORM_PROMPT )->SetHelpText(_("The gdb prompt.")); #if USE_SS_GDB_CONTROL parent->FindWindow( ecID_MODIFY_PLATFORM_SS_GDB )->SetHelpText(_("TODO")); #endif parent->FindWindow( wxID_OK )->SetHelpText(_("Closes the dialog and saves any changes you have made.")); parent->FindWindow( wxID_CANCEL )->SetHelpText(_("Closes the dialog without saving any changes you have made.")); #if __WXGTK__ parent->FindWindow( wxID_CONTEXT_HELP )->SetHelpText(_("Invokes context-sensitive help for the clicked-on window.")); #endif // Add validators parent->FindWindow( ecID_MODIFY_PLATFORM_NAME )->SetValidator(wxGenericValidator(& m_strPlatform)); parent->FindWindow( ecID_MODIFY_PLATFORM_PREFIX )->SetValidator(wxGenericValidator(& m_strPrefix)); parent->FindWindow( ecID_MODIFY_PLATFORM_ARGS )->SetValidator(wxGenericValidator(& m_strGDB)); parent->FindWindow( ecID_MODIFY_PLATFORM_INFERIOR )->SetValidator(wxGenericValidator(& m_strInferior)); parent->FindWindow( ecID_MODIFY_PLATFORM_PROMPT )->SetValidator(wxGenericValidator(& m_strPrompt)); #if USE_SS_GDB_CONTROL parent->FindWindow( ecID_MODIFY_PLATFORM_SS_GDB )->SetValidator(wxGenericValidator(& m_bServerSideGdb)); #endif }
void ControllerNotebook::CreateControllerPages(wxBoxSizer * sizerFrame) { sizerNotebook_ = new wxNotebookSizer(this); sizerFrame->Add(sizerNotebook_, 1, wxEXPAND | wxALL, 4); // create launcher launcher_panel_ = new Launcher (this, Launcher_ID, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE); AddPage(launcher_panel_, wxT("Launcher"), FALSE,0); // create ns_browser page ns_browser_panel = new wxPanel(this); ns_browser_ = new NSBrowserTreeCtrl (ns_browser_panel, NSBrowserTree_Ctrl, wxDefaultPosition, wxSize(400,400), wxTR_DEFAULT_STYLE ); AddPage( ns_browser_panel, wxT("NS Browser"), FALSE, 0 ); // create Deployment page deployment_panel_ = new Deployment(this, DEPLOYMENT_ID, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE); AddPage(deployment_panel_, wxT("Deployment"), FALSE,0); // create Explorer page //qcexplorer_panel = new wxPanel(this); // qcexplorer_=new QCexplorerTreeCtrl (qcexplorer_panel, QCexplorerTree_Ctrl, wxDefaultPosition, wxSize(200,200), wxTR_DEFAULT_STYLE); // AddPage(qcexplorer_panel, wxT("Explorer"), FALSE,0); // create Explorer page explorer_panel=new QedoExplorer(this, QEDOEXPLORER_ID, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE ); AddPage(explorer_panel,wxT("Explorer"), FALSE,0); SetSelection(0); }
bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) { wxString msg; int x, y; if( !Validate() ) return true; if( !m_panelGeneral->Validate() ) return true; if( !m_localSettingsPanel->Validate() ) return true; m_OrientValidator.TransferFromWindow(); aPad->SetAttribute( code_type[m_PadType->GetSelection()] ); aPad->SetShape( code_shape[m_PadShape->GetSelection()] ); // Read pad clearances values: aPad->SetLocalClearance( ValueFromTextCtrl( *m_NetClearanceValueCtrl ) ); aPad->SetLocalSolderMaskMargin( ValueFromTextCtrl( *m_SolderMaskMarginCtrl ) ); aPad->SetLocalSolderPasteMargin( ValueFromTextCtrl( *m_SolderPasteMarginCtrl ) ); aPad->SetThermalWidth( ValueFromTextCtrl( *m_ThermalWidthCtrl ) ); aPad->SetThermalGap( ValueFromTextCtrl( *m_ThermalGapCtrl ) ); double dtmp = 0.0; msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg.ToDouble( &dtmp ); // A -50% margin ratio means no paste on a pad, the ratio must be >= -50% if( dtmp < -50.0 ) dtmp = -50.0; // A margin ratio is always <= 0 // 0 means use full pad copper area if( dtmp > 0.0 ) dtmp = 0.0; aPad->SetLocalSolderPasteMarginRatio( dtmp / 100 ); switch( m_ZoneConnectionChoice->GetSelection() ) { default: case 0: aPad->SetZoneConnection( PAD_ZONE_CONN_INHERITED ); break; case 1: aPad->SetZoneConnection( PAD_ZONE_CONN_FULL ); break; case 2: aPad->SetZoneConnection( PAD_ZONE_CONN_THERMAL ); break; case 3: aPad->SetZoneConnection( PAD_ZONE_CONN_NONE ); break; } // Read pad position: x = ValueFromTextCtrl( *m_PadPosition_X_Ctrl ); y = ValueFromTextCtrl( *m_PadPosition_Y_Ctrl ); aPad->SetPosition( wxPoint( x, y ) ); aPad->SetPos0( wxPoint( x, y ) ); // Read pad drill: x = ValueFromTextCtrl( *m_PadDrill_X_Ctrl ); y = ValueFromTextCtrl( *m_PadDrill_Y_Ctrl ); if( m_DrillShapeCtrl->GetSelection() == 0 ) { aPad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); y = x; } else aPad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); aPad->SetDrillSize( wxSize( x, y ) ); // Read pad shape size: x = ValueFromTextCtrl( *m_ShapeSize_X_Ctrl ); y = ValueFromTextCtrl( *m_ShapeSize_Y_Ctrl ); if( aPad->GetShape() == PAD_SHAPE_CIRCLE ) y = x; aPad->SetSize( wxSize( x, y ) ); // Read pad length die aPad->SetPadToDieLength( ValueFromTextCtrl( *m_LengthPadToDieCtrl ) ); // For a trapezoid, test delta value (be sure delta is not too large for pad size) // remember DeltaSize.x is the Y size variation bool error = false; if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID ) { wxSize delta; // For a trapezoid, only one of delta.x or delta.y is not 0, depending on // the direction. if( m_trapDeltaDirChoice->GetSelection() == 0 ) delta.x = ValueFromTextCtrl( *m_ShapeDelta_Ctrl ); else delta.y = ValueFromTextCtrl( *m_ShapeDelta_Ctrl ); if( delta.x < 0 && delta.x <= -aPad->GetSize().y ) { delta.x = -aPad->GetSize().y + 2; error = true; } if( delta.x > 0 && delta.x >= aPad->GetSize().y ) { delta.x = aPad->GetSize().y - 2; error = true; } if( delta.y < 0 && delta.y <= -aPad->GetSize().x ) { delta.y = -aPad->GetSize().x + 2; error = true; } if( delta.y > 0 && delta.y >= aPad->GetSize().x ) { delta.y = aPad->GetSize().x - 2; error = true; } aPad->SetDelta( delta ); } // Read pad shape offset: x = ValueFromTextCtrl( *m_ShapeOffset_X_Ctrl ); y = ValueFromTextCtrl( *m_ShapeOffset_Y_Ctrl ); aPad->SetOffset( wxPoint( x, y ) ); aPad->SetOrientation( m_OrientValue * 10.0 ); msg = m_PadNumCtrl->GetValue().Left( 4 ); aPad->SetPadName( msg ); // Check if user has set an existing net name const NETINFO_ITEM* netinfo = m_board->FindNet( m_PadNetNameCtrl->GetValue() ); if( netinfo != NULL ) aPad->SetNetCode( netinfo->GetNet() ); else aPad->SetNetCode( NETINFO_LIST::UNCONNECTED ); // Clear some values, according to the pad type and shape switch( aPad->GetShape() ) { case PAD_SHAPE_CIRCLE: aPad->SetOffset( wxPoint( 0, 0 ) ); aPad->SetDelta( wxSize( 0, 0 ) ); x = aPad->GetSize().x; aPad->SetSize( wxSize( x, x ) ); break; case PAD_SHAPE_RECT: aPad->SetDelta( wxSize( 0, 0 ) ); break; case PAD_SHAPE_OVAL: aPad->SetDelta( wxSize( 0, 0 ) ); break; case PAD_SHAPE_TRAPEZOID: break; case PAD_SHAPE_ROUNDRECT: aPad->SetDelta( wxSize( 0, 0 ) ); break; default: ; } switch( aPad->GetAttribute() ) { case PAD_ATTRIB_STANDARD: break; case PAD_ATTRIB_CONN: case PAD_ATTRIB_SMD: // SMD and PAD_ATTRIB_CONN has no hole. // basically, SMD and PAD_ATTRIB_CONN are same type of pads // PAD_ATTRIB_CONN has just a default non technical layers that differs from SMD // and are intended to be used in virtual edge board connectors // However we can accept a non null offset, // mainly to allow complex pads build from a set of basic pad shapes aPad->SetDrillSize( wxSize( 0, 0 ) ); break; case PAD_ATTRIB_HOLE_NOT_PLATED: // Mechanical purpose only: // no offset, no net name, no pad name allowed aPad->SetOffset( wxPoint( 0, 0 ) ); aPad->SetPadName( wxEmptyString ); aPad->SetNetCode( NETINFO_LIST::UNCONNECTED ); break; default: DisplayError( NULL, wxT( "Error: unknown pad type" ) ); break; } if( aPad->GetShape() == PAD_SHAPE_ROUNDRECT ) { wxString value = m_tcCornerSizeRatio->GetValue(); double rrRadiusRatioPercent; if( value.ToDouble( &rrRadiusRatioPercent ) ) aPad->SetRoundRectRadiusRatio( rrRadiusRatioPercent / 100.0 ); } LSET padLayerMask; switch( m_rbCopperLayersSel->GetSelection() ) { case 0: padLayerMask.set( F_Cu ); break; case 1: padLayerMask.set( B_Cu ); break; case 2: padLayerMask |= LSET::AllCuMask(); break; case 3: // No copper layers break; } if( m_PadLayerAdhCmp->GetValue() ) padLayerMask.set( F_Adhes ); if( m_PadLayerAdhCu->GetValue() ) padLayerMask.set( B_Adhes ); if( m_PadLayerPateCmp->GetValue() ) padLayerMask.set( F_Paste ); if( m_PadLayerPateCu->GetValue() ) padLayerMask.set( B_Paste ); if( m_PadLayerSilkCmp->GetValue() ) padLayerMask.set( F_SilkS ); if( m_PadLayerSilkCu->GetValue() ) padLayerMask.set( B_SilkS ); if( m_PadLayerMaskCmp->GetValue() ) padLayerMask.set( F_Mask ); if( m_PadLayerMaskCu->GetValue() ) padLayerMask.set( B_Mask ); if( m_PadLayerECO1->GetValue() ) padLayerMask.set( Eco1_User ); if( m_PadLayerECO2->GetValue() ) padLayerMask.set( Eco2_User ); if( m_PadLayerDraft->GetValue() ) padLayerMask.set( Dwgs_User ); aPad->SetLayerSet( padLayerMask ); return error; }
size_t CodeRefactoring::SearchInFiles(const wxArrayString& files, const wxString& targetText) { EditorManager* edMan = Manager::Get()->GetEditorManager(); m_SearchDataMap.clear(); // now that list is filled, we'll search wxWindow* parent = edMan->GetBuiltinActiveEditor()->GetParent(); cbStyledTextCtrl* control = new cbStyledTextCtrl(parent, wxID_ANY, wxDefaultPosition, wxSize(0, 0)); control->Show(false); // let's create a progress dialog because it might take some time depending on the files count wxProgressDialog* progress = new wxProgressDialog(_("Code Refactoring"), _("Please wait while searching inside the project..."), files.GetCount(), Manager::Get()->GetAppWindow(), wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); PlaceWindow(progress); for (size_t i = 0; i < files.GetCount(); ++i) { // update the progress bar if (!progress->Update(i)) break; // user pressed "Cancel" // check if the file is already opened in built-in editor and do search in it cbEditor* ed = edMan->IsBuiltinOpen(files[i]); if (ed) control->SetText(ed->GetControl()->GetText()); else // else load the file in the control { EncodingDetector detector(files[i]); if (!detector.IsOK()) continue; // failed control->SetText(detector.GetWxStr()); } Find(control, files[i], targetText); } delete control; // done with it delete progress; // done here too return m_SearchDataMap.size(); }
wxSizer *Inventory( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); item0->AddGrowableCol( 0 ); item0->AddGrowableRow( 2 ); wxFlexGridSizer *item1 = new wxFlexGridSizer( 4, 0, 0 ); item1->AddGrowableCol( 1 ); item1->AddGrowableCol( 3 ); wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 ); item2->AddGrowableCol( 0 ); item2->AddGrowableCol( 1 ); wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0 ); item3->AddGrowableCol( 1 ); wxStaticText *item4 = new wxStaticText( parent, ID_TEXT, wxT("SKU"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item5 = new wxTextCtrl( parent, ID_INV_SKU, wxT(""), wxDefaultPosition, wxSize(140,-1), 0 ); item3->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item6 = new wxStaticText( parent, ID_TEXT, wxT("Name"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item6, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item7 = new wxTextCtrl( parent, ID_INV_ITEMNAME, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item3->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item8 = new wxStaticText( parent, ID_TEXT, wxT("Department"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item9 = new wxTextCtrl( parent, ID_INV_DEPARTMENT, wxT(""), wxDefaultPosition, wxSize(70,-1), 0 ); item3->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item10 = new wxStaticText( parent, ID_TEXT, wxT("Item Type"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item11 = new wxTextCtrl( parent, ID_INV_TYPE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item3->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item12 = new wxStaticText( parent, ID_TEXT, wxT("Price"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item13 = new wxTextCtrl( parent, ID_INV_PRICE, wxT(""), wxDefaultPosition, wxSize(70,-1), 0 ); item3->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item14 = new wxStaticText( parent, ID_TEXT, wxT("Wholesale"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item14, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item15 = new wxTextCtrl( parent, ID_INV_WHOLESALE, wxT(""), wxDefaultPosition, wxSize(150,-1), 0 ); item3->Add( item15, 0, wxALL, 5 ); wxStaticText *item16 = new wxStaticText( parent, ID_TEXT, wxT("Weight (lbs)"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item16, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item17 = new wxTextCtrl( parent, ID_INV_WEIGHT, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item3->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item18 = new wxStaticText( parent, ID_TEXT, wxT("Vendor"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item18, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item19 = new wxTextCtrl( parent, ID_INV_VENDOR, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item3->Add( item19, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item20 = new wxStaticText( parent, ID_TEXT, wxT("Tax Type"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item20, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString strs21[] = { wxT("ChoiceItem") }; wxChoice *item21 = new wxChoice( parent, ID_INV_TAX_TYPE, wxDefaultPosition, wxSize(100,-1), 1, strs21, 0 ); item3->Add( item21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); wxFlexGridSizer *item22 = new wxFlexGridSizer( 2, 0, 0 ); item22->AddGrowableCol( 1 ); item22->AddGrowableRow( 1 ); wxStaticText *item23 = new wxStaticText( parent, ID_TEXT, wxT("Bar Code"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item24 = new wxTextCtrl( parent, ID_INV_BARCODE, wxT(""), wxDefaultPosition, wxSize(120,-1), 0 ); item22->Add( item24, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item25 = new wxStaticText( parent, ID_TEXT, wxT("Description"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item25, 0, wxALIGN_RIGHT|wxALL, 5 ); wxTextCtrl *item26 = new wxTextCtrl( parent, ID_INV_DESC, wxT(""), wxDefaultPosition, wxSize(150,-1), wxTE_MULTILINE ); item22->Add( item26, 0, wxGROW|wxALL, 5 ); item22->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxCheckBox *item27 = new wxCheckBox( parent, ID_INV_FREIGHT, wxT("Freight Only"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item27, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item22->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxCheckBox *item28 = new wxCheckBox( parent, ID_INV_OVERSIZE, wxT("Oversized"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item28, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item29 = new wxStaticText( parent, ID_TEXT, wxT("On Hand"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item29, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSpinCtrl *item30 = new wxSpinCtrl( parent, ID_INV_ONHAND, wxT("0"), wxDefaultPosition, wxSize(100,-1), 0, 0, 1000000, 0 ); item22->Add( item30, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item31 = new wxStaticText( parent, ID_TEXT, wxT("On Order"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item31, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSpinCtrl *item32 = new wxSpinCtrl( parent, ID_INV_ONORDER, wxT("0"), wxDefaultPosition, wxSize(100,-1), 0, 0, 1000000, 0 ); item22->Add( item32, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item33 = new wxStaticText( parent, ID_TEXT, wxT("Reorder Level"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item33, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSpinCtrl *item34 = new wxSpinCtrl( parent, ID_INV_REORDER_LEVEL, wxT("0"), wxDefaultPosition, wxSize(100,-1), 0, 0, 100000, 0 ); item22->Add( item34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( item22, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item1->Add( item2, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxBoxSizer *item35 = new wxBoxSizer( wxVERTICAL ); wxButton *item36 = new wxButton( parent, ID_INV_NEW, wxT("New Item"), wxDefaultPosition, wxDefaultSize, 0 ); item35->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item37 = new wxButton( parent, ID_INV_SEARCH, wxT("Search"), wxDefaultPosition, wxDefaultSize, 0 ); item37->SetToolTip( wxT("Search by text in field") ); item35->Add( item37, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item38 = new wxButton( parent, ID_INV_CLEAR, wxT("Clear"), wxDefaultPosition, wxDefaultSize, 0 ); item35->Add( item38, 0, wxALIGN_CENTER|wxALL, 5 ); wxStaticLine *item39 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL ); item35->Add( item39, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item40 = new wxButton( parent, ID_INV_SAVE, wxT("Save"), wxDefaultPosition, wxDefaultSize, 0 ); item40->Enable( FALSE ); item35->Add( item40, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item41 = new wxButton( parent, ID_INV_CANCEL, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); item35->Add( item41, 0, wxALIGN_CENTER|wxALL, 5 ); wxStaticLine *item42 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL ); item35->Add( item42, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item43 = new wxButton( parent, ID_INV_CLEAR_RESULTS, wxT("Clear Results"), wxDefaultPosition, wxDefaultSize, 0 ); item35->Add( item43, 0, wxALIGN_CENTER|wxALL, 5 ); item1->Add( item35, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticLine *item44 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL ); item0->Add( item44, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxListCtrl *item45 = new wxListCtrl( parent, ID_INV_LIST, wxDefaultPosition, wxSize(160,140), wxLC_REPORT|wxSUNKEN_BORDER ); item0->Add( item45, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); YardFooter *item46 = new YardFooter( parent, ID_PANEL, wxDefaultPosition, wxSize(200,90), 0 ); item0->Add( item46, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
size_t CodeRefactoring::VerifyResult(const TokenIdxSet& targetResult, const wxString& targetText, bool isLocalVariable) { EditorManager* edMan = Manager::Get()->GetEditorManager(); cbEditor* editor = edMan->GetBuiltinActiveEditor(); if (!editor) return 0; Token* parentOfLocalVariable = _nullptr; if (isLocalVariable) { TRACK_THREAD_LOCKER(s_TokensTreeCritical); wxCriticalSectionLocker locker(s_TokensTreeCritical); THREAD_LOCKER_SUCCESS(s_TokensTreeCritical); TokensTree* tree = m_NativeParser.GetParser().GetTokensTree(); Token* token = tree->at(*targetResult.begin()); parentOfLocalVariable = tree->at(token->m_ParentIndex); } // now that list is filled, we'll search cbStyledTextCtrl* control = new cbStyledTextCtrl(editor->GetParent(), wxID_ANY, wxDefaultPosition, wxSize(0, 0)); control->Show(false); // styled the text to support control->GetStyleAt() cbEditor::ApplyStyles(control); EditorColourSet edColSet; size_t totalCount = 0; for (SearchDataMap::iterator it = m_SearchDataMap.begin(); it != m_SearchDataMap.end(); ++it) totalCount += it->second.size(); // let's create a progress dialog because it might take some time depending on the files count wxProgressDialog* progress = new wxProgressDialog(_("Code Refactoring"), _("Please wait while verifying result..."), totalCount, Manager::Get()->GetAppWindow(), wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT); PlaceWindow(progress); size_t task = totalCount; TokenIdxSet result; bool userBreak = false; for (SearchDataMap::iterator it = m_SearchDataMap.begin(); it != m_SearchDataMap.end();) { // check if the file is already opened in built-in editor and do search in it cbEditor* ed = edMan->IsBuiltinOpen(it->first); if (ed) control->SetText(ed->GetControl()->GetText()); else // else load the file in the control { EncodingDetector detector(it->first); if (!detector.IsOK()) { task -= it->second.size(); m_SearchDataMap.erase(it++); continue; // failed } control->SetText(detector.GetWxStr()); } // apply the corlor setting edColSet.Apply(editor->GetLanguage(), control); ccSearchData searchData = { control, it->first }; for (SearchDataList::iterator itList = it->second.begin(); itList != it->second.end();) { // update the progress bar if (!progress->Update(totalCount - (--task))) { userBreak = true; break; // user pressed "Cancel" } // skip string or comment const int style = control->GetStyleAt(itList->pos); if (control->IsString(style) || control->IsComment(style)) { it->second.erase(itList++); continue; } // do cc search const int endOfWord = itList->pos + targetText.Len(); control->GotoPos(endOfWord); m_NativeParser.MarkItemsByAI(&searchData, result, true, false, true, endOfWord); if (result.empty()) { it->second.erase(itList++); continue; } // verify result TokenIdxSet::iterator findIter = targetResult.begin(); for (; findIter != targetResult.end(); ++findIter) { if (result.find(*findIter) != result.end()) break; } if (findIter == targetResult.end()) // not found it->second.erase(itList++); else { // handle for local variable if (isLocalVariable) { TRACK_THREAD_LOCKER(s_TokensTreeCritical); wxCriticalSectionLocker locker(s_TokensTreeCritical); THREAD_LOCKER_SUCCESS(s_TokensTreeCritical); TokensTree* tree = m_NativeParser.GetParser().GetTokensTree(); Token* token = tree->at(*findIter); if (token) { Token* parent = tree->at(token->m_ParentIndex); if (parent != parentOfLocalVariable) { it->second.erase(itList++); continue; } } } ++itList; } } if (it->second.empty()) m_SearchDataMap.erase(it++); else ++it; if (userBreak) break; } delete control; // done with it delete progress; // done here too return m_SearchDataMap.size(); }
wxSizer *Sale( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); item0->AddGrowableCol( 0 ); item0->AddGrowableRow( 0 ); wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 ); item1->AddGrowableCol( 0 ); item1->AddGrowableRow( 0 ); wxFlexGridSizer *item2 = new wxFlexGridSizer( 1, 0, 0 ); item2->AddGrowableCol( 0 ); item2->AddGrowableRow( 1 ); wxStaticBox *item4 = new wxStaticBox( parent, -1, wxT("Customer") ); wxStaticBoxSizer *item3 = new wxStaticBoxSizer( item4, wxVERTICAL ); wxFlexGridSizer *item5 = new wxFlexGridSizer( 2, 0, 0 ); wxStaticText *item6 = new wxStaticText( parent, ID_TEXT, wxT("First Name"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item7 = new wxStaticText( parent, ID_TEXT, wxT("William"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item8 = new wxStaticText( parent, ID_TEXT, wxT("Middle Name"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item9 = new wxStaticText( parent, ID_TEXT, wxT("Joe"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item10 = new wxStaticText( parent, ID_TEXT, wxT("Last Name"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item11 = new wxStaticText( parent, ID_TEXT, wxT("Smith"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item12 = new wxStaticText( parent, ID_TEXT, wxT("Address 1"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item13 = new wxStaticText( parent, ID_TEXT, wxT("256 Elderberry Lane"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item14 = new wxStaticText( parent, ID_TEXT, wxT("Address 2"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item15 = new wxStaticText( parent, ID_TEXT, wxT("Apt 33"), wxDefaultPosition, wxDefaultSize, 0 ); item5->Add( item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item3->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item16 = new wxButton( parent, ID_BUTTON, wxT("Edit"), wxDefaultPosition, wxDefaultSize, 0 ); item3->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( item3, 0, wxGROW|wxALL, 5 ); wxFlexGridSizer *item17 = new wxFlexGridSizer( 2, 0, 0 ); item17->AddGrowableCol( 0 ); item17->AddGrowableRow( 0 ); wxTreeCtrl *item18 = new wxTreeCtrl( parent, ID_TREECTRL, wxDefaultPosition, wxSize(350,160), wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT|wxSUNKEN_BORDER ); item17->Add( item18, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( item17, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL, 5 ); item1->Add( item2, 0, wxGROW, 5 ); wxStaticBox *item20 = new wxStaticBox( parent, -1, wxT("Transaction") ); wxStaticBoxSizer *item19 = new wxStaticBoxSizer( item20, wxHORIZONTAL ); wxFlexGridSizer *item21 = new wxFlexGridSizer( 1, 0, 0 ); item21->AddGrowableCol( 0 ); item21->AddGrowableRow( 0 ); wxListCtrl *item22 = new wxListCtrl( parent, ID_SALE_TRANS, wxDefaultPosition, wxSize(260,120), wxLC_REPORT|wxSUNKEN_BORDER ); item21->Add( item22, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxWindow *item23 = parent->FindWindow( ID_SALE_TRASH ); wxASSERT( item23 ); item21->Add( item23, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item19->Add( item21, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item1->Add( item19, 0, wxGROW|wxALL, 5 ); item0->Add( item1, 0, wxGROW, 5 ); YardFooter *item24 = new YardFooter( parent, ID_PANEL, wxDefaultPosition, wxSize(200,90), 0 ); item0->Add( item24, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
// The `main program' equivalent, creating the windows and returning the // main frame bool AudacityApp::OnInit() { // Unused strings that we want to be translated, even though // we're not using them yet... wxString future1 = _("Master Gain Control"); wxString future2 = _("Input Meter"); wxString future3 = _("Output Meter"); ::wxInitAllImageHandlers(); wxFileSystem::AddHandler(new wxZipFSHandler); InitPreferences(); #if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__) this->AssociateFileTypes(); #endif // // Paths: set search path and temp dir path // wxString home = wxGetHomeDir(); mAppHomeDir = home; // On Unix systems, the default temp dir is in /tmp. // Search path (in this order): // * The AUDACITY_PATH environment variable // * The current directory // * The user's .audacity-files directory in their home directory // * The "share" and "share/doc" directories in their install path #ifdef __WXGTK__ defaultTempDir.Printf(wxT("/tmp/audacity1.2-%s"), wxGetUserId().c_str()); wxString pathVar = wxGetenv(wxT("AUDACITY_PATH")); if (pathVar != wxT("")) AddMultiPathsToPathList(pathVar, audacityPathList); AddUniquePathToPathList(FROMFILENAME(::wxGetCwd()), audacityPathList); AddUniquePathToPathList(wxString::Format(wxT("%s/.audacity-files"), home.c_str()), audacityPathList); #ifdef AUDACITY_NAME AddUniquePathToPathList(wxString::Format(wxT("%s/share/%s"), wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)), audacityPathList); AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/%s"), wxT(INSTALL_PREFIX), wxT(AUDACITY_NAME)), audacityPathList); #else AddUniquePathToPathList(wxString::Format(wxT("%s/share/audacity"), wxT(INSTALL_PREFIX)), audacityPathList); AddUniquePathToPathList(wxString::Format(wxT("%s/share/doc/audacity"), wxT(INSTALL_PREFIX)), audacityPathList); #endif AddUniquePathToPathList(wxString::Format(wxT("%s/share/locale"), wxT(INSTALL_PREFIX)), audacityPathList); #endif wxFileName tmpFile; tmpFile.AssignTempFileName(wxT("nn")); wxString tmpDirLoc = tmpFile.GetPath(wxPATH_GET_VOLUME); ::wxRemoveFile(FILENAME(tmpFile.GetFullPath())); // On Mac and Windows systems, use the directory which contains Audacity. #ifdef __WXMSW__ // On Windows, the path to the Audacity program is in argv[0] wxString progPath = wxPathOnly(argv[0]); AddUniquePathToPathList(progPath, audacityPathList); AddUniquePathToPathList(progPath+wxT("\\Languages"), audacityPathList); defaultTempDir.Printf(wxT("%s\\audacity_1_2_temp"), tmpDirLoc.c_str()); #endif #ifdef __MACOSX__ // On Mac OS X, the path to the Audacity program is in argv[0] wxString progPath = wxPathOnly(argv[0]); AddUniquePathToPathList(progPath, audacityPathList); // If Audacity is a "bundle" package, then the root directory is // the great-great-grandparent of the directory containing the executable. AddUniquePathToPathList(progPath+wxT("/../../../"), audacityPathList); AddUniquePathToPathList(progPath+wxT("/Languages"), audacityPathList); AddUniquePathToPathList(progPath+wxT("/../../../Languages"), audacityPathList); defaultTempDir.Printf(wxT("%s/audacity1.2-%s"), tmpDirLoc.c_str(), wxGetUserId().c_str()); #endif #ifdef __MACOS9__ // On Mac OS 9, the initial working directory is the one that // contains the program. wxString progPath = wxGetCwd(); AddUniquePathToPathList(progPath, audacityPathList); AddUniquePathToPathList(progPath+wxT(":Languages"), audacityPathList); defaultTempDir.Printf(wxT("%s/audacity_1_2_temp"), tmpDirLoc.c_str()); #endif // BG: Create a temporary window to set as the top window wxFrame *temporarywindow = new wxFrame(NULL, -1, wxT("temporarytopwindow")); SetTopWindow(temporarywindow); // Locale // wxWindows 2.3 has a much nicer wxLocale API. We can make this code much // better once we move to wx 2.3/2.4. wxString lang = gPrefs->Read(wxT("/Locale/Language"), wxT("")); // Pop up a dialog the first time the program is run if (lang == wxT("")) lang = ChooseLanguage(NULL); #ifdef NOT_RQD //TIDY-ME: (CleanSpeech) Language prompt?? // The prompt for language only happens ONCE on a system. // I don't think we should disable it JKC wxString lang = gPrefs->Read(wxT("/Locale/Language"), "en"); //lda // Pop up a dialog the first time the program is run //lda if (lang == "") //lda lang = ChooseLanguage(NULL); #endif gPrefs->Write(wxT("/Locale/Language"), lang); if (lang != wxT("en")) { wxLogNull nolog; mLocale = new wxLocale(wxT(""), lang, wxT(""), true, true); for(unsigned int i=0; i<audacityPathList.GetCount(); i++) mLocale->AddCatalogLookupPathPrefix(audacityPathList[i]); #ifdef AUDACITY_NAME mLocale->AddCatalog(wxT(AUDACITY_NAME)); #else mLocale->AddCatalog(wxT("audacity")); #endif } else mLocale = NULL; // Initialize internationalisation (number formats etc.) // // This must go _after_ creating the wxLocale instance because // creating the wxLocale instance sets the application-wide locale. Internat::Init(); // Init DirManager, which initializes the temp directory // If this fails, we must exit the program. if (!InitTempDir()) { FinishPreferences(); return false; } // More initialization InitCleanSpeech(); InitDitherers(); InitAudioIO(); LoadEffects(); #ifdef __WXMAC__ // On the Mac, users don't expect a program to quit when you close the last window. // Create an offscreen frame with a menu bar. The frame should never // be visible, but when all other windows are closed, this menu bar should // become visible. gParentFrame = new wxFrame(NULL, -1, wxT("invisible"), wxPoint(5000, 5000), wxSize(100, 100)); wxMenu *fileMenu = new wxMenu(); fileMenu->Append(wxID_NEW, wxT("&New\tCtrl+N")); fileMenu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O")); /* i18n-hint: Mac OS X shortcut should be Ctrl+, */ fileMenu->Append(wxID_PREFERENCES, _("&Preferences...\tCtrl+,")); wxMenuBar *menuBar = new wxMenuBar(); menuBar->Append(fileMenu, wxT("&File")); gParentFrame->SetMenuBar(menuBar); gParentFrame->Show(); SetTopWindow(gParentFrame); #endif SetExitOnFrameDelete(true); /////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// //Initiate pointers to toolbars here, and create //the toolbars that should be loaded at startup. gControlToolBarStub = LoadToolBar( wxT(""),true, gParentWindow,ControlToolBarID); gMixerToolBarStub = LoadToolBar( wxT("/GUI/EnableMixerToolBar"),true, gParentWindow,MixerToolBarID); gMeterToolBarStub = LoadToolBar( wxT("/GUI/EnableMeterToolBar"),true, gParentWindow,MeterToolBarID); gEditToolBarStub = LoadToolBar( wxT("/GUI/EnableEditToolBar"),true, gParentWindow,EditToolBarID); gTranscriptionToolBarStub = LoadToolBar( wxT("/GUI/EnableTranscriptionToolBar"),false, gParentWindow,TranscriptionToolBarID); /// ToolBar Initiation Complete. //////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// AudacityProject *project = CreateNewAudacityProject(gParentWindow); SetTopWindow(project); delete temporarywindow; // Can't handle command-line args on Mac OS X yet... // Cygwin command-line parser below... #if !defined(__MACOSX__) && !defined(__CYGWIN__) // Parse command-line arguments if (argc > 1) { for (int option = 1; option < argc; option++) { if (!argv[option]) continue; bool handled = false; if (!wxString(wxT("-help")).CmpNoCase(argv[option])) { wxPrintf(/* i18n-hint: '-help', '-test' and '-blocksize' need to stay in English. */ _("Command-line options supported:\n -help (this message)\n -test (run self diagnostics)\n -blocksize ### (set max disk block size in bytes)\n\nIn addition, specify the name of an audio file or Audacity project\nto open it.\n\n")); exit(0); } if (option < argc - 1 && argv[option + 1] && !wxString(wxT("-blocksize")).CmpNoCase(argv[option])) { long theBlockSize; if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { if (theBlockSize >= 256 && theBlockSize < 100000000) { wxFprintf(stderr, _("Using block size of %ld\n"), theBlockSize); Sequence::SetMaxDiskBlockSize(theBlockSize); } } option++; handled = true; } if (!handled && !wxString(wxT("-test")).CmpNoCase(argv[option])) { RunBenchmark(NULL); exit(0); } if (argv[option][0] == wxT('-') && !handled) { wxPrintf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } if (!handled) project->OpenFile(argv[option]); } // for option... } // if (argc>1) #endif // not Mac OS X // Cygwin command line parser (by Dave Fancella) #if defined(__CYGWIN__) if (argc > 1) { int optionstart = 1; bool startAtOffset = false; // Scan command line arguments looking for trouble for (int option = 1; option < argc; option++) { if (!argv[option]) continue; // Check to see if argv[0] is copied across other arguments. // This is the reason Cygwin gets its own command line parser. if (wxString(argv[option]).Lower().Contains(wxString(wxT("audacity.exe")))) { startAtOffset = true; optionstart = option + 1; } } for (int option = optionstart; option < argc; option++) { if (!argv[option]) continue; bool handled = false; bool openThisFile = false; wxString fileToOpen; if (!wxString(wxT("-help")).CmpNoCase(argv[option])) { wxPrintf(/* i18n-hint: '-help', '-test' and '-blocksize' need to stay in English. */ _("Command-line options supported:\n" " -help (this message)\n" " -test (run self diagnostics)\n" " -blocksize ### (set max disk block size in bytes)\n" "\n" "In addition, specify the name of an audio file or " "Audacity project\n" "to open it.\n" "\n")); exit(0); } if (option < argc - 1 && argv[option + 1] && !wxString(wxT("-blocksize")).CmpNoCase(argv[option])) { long theBlockSize; if (wxString(argv[option + 1]).ToLong(&theBlockSize)) { if (theBlockSize >= 256 && theBlockSize < 100000000) { wxFprintf(stderr, _("Using block size of %ld\n"), theBlockSize); Sequence::SetMaxDiskBlockSize(theBlockSize); } } option++; handled = true; } if (!handled && !wxString(wxT("-test")).CmpNoCase(argv[option])) { RunBenchmark(NULL); exit(0); } if (argv[option][0] == wxT('-') && !handled) { wxPrintf(_("Unknown command line option: %s\n"), argv[option]); exit(0); } if(handled) fileToOpen.Clear(); if (!handled) fileToOpen = fileToOpen + wxT(" ") + argv[option]; if(wxString(argv[option]).Lower().Contains(wxT(".aup"))) openThisFile = true; if(openThisFile) { openThisFile = false; project->OpenFile(fileToOpen); } } // for option... } // if (argc>1) #endif // Cygwin command-line parser return TRUE; }
wxSizer *Employee( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); item0->AddGrowableCol( 0 ); item0->AddGrowableRow( 0 ); wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 ); item1->AddGrowableCol( 1 ); item1->AddGrowableRow( 0 ); wxTreeCtrl *item2 = new wxTreeCtrl( parent, ID_EMPLOY_TREE, wxDefaultPosition, wxSize(120,160), wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT|wxSUNKEN_BORDER ); item1->Add( item2, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); wxFlexGridSizer *item3 = new wxFlexGridSizer( 1, 0, 0 ); item3->AddGrowableCol( 0 ); item3->AddGrowableRow( 1 ); wxFlexGridSizer *item4 = new wxFlexGridSizer( 2, 0, 0 ); wxWindow *item5 = parent->FindWindow( ID_EMPLOY_PICTURE ); wxASSERT( item5 ); item4->Add( item5, 0, wxALL, 5 ); wxBoxSizer *item6 = new wxBoxSizer( wxVERTICAL ); wxStaticText *item7 = new wxStaticText( parent, ID_EMPLOY_HIRE, wxT("Hire date: 1/8/81"), wxDefaultPosition, wxDefaultSize, 0 ); item6->Add( item7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item8 = new wxStaticText( parent, ID_EMPLOY_POSITION, wxT("Title: Manager"), wxDefaultPosition, wxDefaultSize, 0 ); item6->Add( item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item4->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item3->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); wxFlexGridSizer *item9 = new wxFlexGridSizer( 4, 0, 0 ); item9->AddGrowableCol( 1 ); item9->AddGrowableCol( 3 ); wxStaticText *item10 = new wxStaticText( parent, ID_TEXT, wxT("First Name"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item10, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item11 = new wxTextCtrl( parent, ID_EMPLOY_FIRST, wxT(""), wxDefaultPosition, wxSize(100,-1), 0 ); item9->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item12 = new wxStaticText( parent, ID_TEXT, wxT("ID"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item12, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item13 = new wxTextCtrl( parent, ID_EMPLOY_ID, wxT(""), wxDefaultPosition, wxSize(100,-1), 0 ); item9->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item14 = new wxStaticText( parent, ID_TEXT, wxT("Middle"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item14, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item15 = new wxTextCtrl( parent, ID_EMPLOY_MIDDLE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item9->Add( item15, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item16 = new wxStaticText( parent, ID_TEXT, wxT("Tax ID"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item16, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item17 = new wxTextCtrl( parent, ID_EMPLOY_TAX_ID, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item9->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item18 = new wxStaticText( parent, ID_TEXT, wxT("Last Name"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item18, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item19 = new wxTextCtrl( parent, ID_EMPLOY_LAST, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item9->Add( item19, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item20 = new wxStaticText( parent, ID_TEXT, wxT("Phone"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item20, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxTextCtrl *item21 = new wxTextCtrl( parent, ID_EMPLOY_PHONE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 ); item9->Add( item21, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticText *item22 = new wxStaticText( parent, ID_TEXT, wxT("Address"), wxDefaultPosition, wxDefaultSize, 0 ); item9->Add( item22, 0, wxALIGN_RIGHT|wxALL, 5 ); wxTextCtrl *item23 = new wxTextCtrl( parent, ID_EMPLOY_ADDRESS, wxT(""), wxDefaultPosition, wxSize(80,-1), wxTE_MULTILINE ); item9->Add( item23, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item3->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item1, 0, 0, 5 ); YardFooter *item24 = new YardFooter( parent, ID_PANEL, wxDefaultPosition, wxSize(200,90), 0 ); item0->Add( item24, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
// // Constructor // ToolManager::ToolManager( AudacityProject *parent ) : wxEvtHandler() { wxPoint pt[ 3 ]; #if defined(__WXMAC__) // Save original transition mTransition = wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ); #endif // Initialize everything mParent = parent; mLastPos.x = mBarPos.x = -1; mLastPos.y = mBarPos.y = -1; mDragWindow = NULL; mDragDock = NULL; mDragBar = NULL; // Create the down arrow pt[ 0 ].x = 0; pt[ 0 ].y = 0; pt[ 1 ].x = 9; pt[ 1 ].y = 9; pt[ 2 ].x = 18; pt[ 2 ].y = 0; // Create the shaped region mDown = new wxRegion( 3, &pt[0] ); // Create the down arrow pt[ 0 ].x = 9; pt[ 0 ].y = 0; pt[ 1 ].x = 0; pt[ 1 ].y = 9; pt[ 2 ].x = 9; pt[ 2 ].y = 18; // Create the shaped region mLeft = new wxRegion( 3, &pt[0] ); // Create the indicator frame mIndicator = new wxFrame( NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 32, 32 ), wxFRAME_TOOL_WINDOW | wxFRAME_SHAPED | wxNO_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP ); // Hook the creation event...only needed on GTK, but doesn't hurt for all mIndicator->Connect( wxEVT_CREATE, wxWindowCreateEventHandler( ToolManager::OnIndicatorCreate ), NULL, this ); // Hook the paint event...needed for all mIndicator->Connect( wxEVT_PAINT, wxPaintEventHandler( ToolManager::OnIndicatorPaint ), NULL, this ); // It's a little shy mIndicator->Hide(); // Hook the parents mouse events...using the parent helps greatly // under GTK mParent->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Connect( wxEVT_MOTION, wxMouseEventHandler( ToolManager::OnMouse ), NULL, this ); mParent->Connect( wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler( ToolManager::OnCaptureLost ), NULL, this ); // Create the top and bottom docks mTopDock = new ToolDock( this, mParent, TopDockID ); mBotDock = new ToolDock( this, mParent, BotDockID ); // Create all of the toolbars mBars[ ToolsBarID ] = new ToolsToolBar(); mBars[ ControlBarID ] = new ControlToolBar(); mBars[ MeterBarID ] = new MeterToolBar(); mBars[ EditBarID ] = new EditToolBar(); mBars[ MixerBarID ] = new MixerToolBar(); mBars[ TranscriptionBarID ] = new TranscriptionToolBar(); mBars[ SelectionBarID ] = new SelectionBar(); mBars[ DeviceBarID ] = new DeviceToolBar(); // We own the timer mTimer.SetOwner( this ); // Process the toolbar config settings ReadConfig(); }
wxSizer *Keyboard( wxWindow *parent, bool call_fit, bool set_sizer ) { wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 ); wxTextCtrl *item1 = new wxTextCtrl( parent, ID_KBD_SCREEN, wxT(""), wxDefaultPosition, wxSize(190,40), wxTE_READONLY ); item1->SetBackgroundColour( *wxLIGHT_GREY ); item1->SetFont( wxFont( 24, wxROMAN, wxNORMAL, wxNORMAL ) ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxFlexGridSizer *item2 = new wxFlexGridSizer( 10, 0, 0 ); wxButton *item3 = new wxButton( parent, ID_KBD_1, wxT("1"), wxDefaultPosition, wxSize(32,32), 0 ); item3->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item4 = new wxButton( parent, ID_KBD_2, wxT("2"), wxDefaultPosition, wxSize(32,32), 0 ); item4->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item5 = new wxButton( parent, ID_KBD_3, wxT("3"), wxDefaultPosition, wxSize(32,32), 0 ); item5->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item6 = new wxButton( parent, ID_KBD_4, wxT("4"), wxDefaultPosition, wxSize(32,32), 0 ); item6->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item7 = new wxButton( parent, ID_KBD_5, wxT("5"), wxDefaultPosition, wxSize(32,32), 0 ); item7->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item8 = new wxButton( parent, ID_KBD_6, wxT("6"), wxDefaultPosition, wxSize(32,32), 0 ); item8->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item9 = new wxButton( parent, ID_KBD_7, wxT("7"), wxDefaultPosition, wxSize(32,32), 0 ); item9->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item10 = new wxButton( parent, ID_KBD_8, wxT("8"), wxDefaultPosition, wxSize(32,32), 0 ); item10->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item11 = new wxButton( parent, ID_KBD_9, wxT("9"), wxDefaultPosition, wxSize(32,32), 0 ); item11->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item12 = new wxButton( parent, ID_KBD_0, wxT("0"), wxDefaultPosition, wxSize(32,32), 0 ); item12->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item2->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 ); wxFlexGridSizer *item13 = new wxFlexGridSizer( 10, 0, 0 ); wxButton *item14 = new wxButton( parent, ID_KBD_Q, wxT("q"), wxDefaultPosition, wxSize(32,32), 0 ); item14->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item15 = new wxButton( parent, ID_KBD_W, wxT("w"), wxDefaultPosition, wxSize(32,32), 0 ); item15->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item16 = new wxButton( parent, ID_KBD_E, wxT("e"), wxDefaultPosition, wxSize(32,32), 0 ); item16->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item17 = new wxButton( parent, ID_KBD_R, wxT("r"), wxDefaultPosition, wxSize(32,32), 0 ); item17->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item18 = new wxButton( parent, ID_KBD_T, wxT("t"), wxDefaultPosition, wxSize(32,32), 0 ); item18->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item19 = new wxButton( parent, ID_KBD_Y, wxT("y"), wxDefaultPosition, wxSize(32,32), 0 ); item19->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item20 = new wxButton( parent, ID_KBD_U, wxT("u"), wxDefaultPosition, wxSize(32,32), 0 ); item20->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item21 = new wxButton( parent, ID_KBD_I, wxT("i"), wxDefaultPosition, wxSize(32,32), 0 ); item21->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item22 = new wxButton( parent, ID_KBD_O, wxT("o"), wxDefaultPosition, wxSize(32,32), 0 ); item22->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item23 = new wxButton( parent, ID_KBD_P, wxT("p"), wxDefaultPosition, wxSize(32,32), 0 ); item23->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item13->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 ); wxFlexGridSizer *item24 = new wxFlexGridSizer( 10, 0, 0 ); wxButton *item25 = new wxButton( parent, ID_KBD_A, wxT("a"), wxDefaultPosition, wxSize(32,32), 0 ); item25->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item26 = new wxButton( parent, ID_KBD_S, wxT("s"), wxDefaultPosition, wxSize(32,32), 0 ); item26->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item27 = new wxButton( parent, ID_KBD_D, wxT("d"), wxDefaultPosition, wxSize(32,32), 0 ); item27->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item28 = new wxButton( parent, ID_KBD_F, wxT("f"), wxDefaultPosition, wxSize(32,32), 0 ); item28->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item29 = new wxButton( parent, ID_KBD_G, wxT("g"), wxDefaultPosition, wxSize(32,32), 0 ); item29->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item30 = new wxButton( parent, ID_KBD_H, wxT("h"), wxDefaultPosition, wxSize(32,32), 0 ); item30->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item30, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item31 = new wxButton( parent, ID_KBD_J, wxT("j"), wxDefaultPosition, wxSize(32,32), 0 ); item31->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item31, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item32 = new wxButton( parent, ID_KBD_K, wxT("k"), wxDefaultPosition, wxSize(32,32), 0 ); item32->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item32, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item33 = new wxButton( parent, ID_KBD_L, wxT("l"), wxDefaultPosition, wxSize(32,32), 0 ); item33->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item24->Add( item33, 0, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 ); wxFlexGridSizer *item34 = new wxFlexGridSizer( 7, 0, 0 ); wxButton *item35 = new wxButton( parent, ID_KBD_SHIFT, wxT("shift"), wxDefaultPosition, wxSize(52,32), 0 ); item35->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item34->Add( item35, 0, wxALIGN_CENTER|wxALL, 5 ); wxFlexGridSizer *item36 = new wxFlexGridSizer( 7, 0, 0 ); wxButton *item37 = new wxButton( parent, ID_KBD_Z, wxT("z"), wxDefaultPosition, wxSize(32,32), 0 ); item37->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item37, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item38 = new wxButton( parent, ID_KBD_X, wxT("x"), wxDefaultPosition, wxSize(32,32), 0 ); item38->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item38, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item39 = new wxButton( parent, ID_KBD_C, wxT("c"), wxDefaultPosition, wxSize(32,32), 0 ); item39->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item39, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item40 = new wxButton( parent, ID_KBD_V, wxT("v"), wxDefaultPosition, wxSize(32,32), 0 ); item40->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item40, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item41 = new wxButton( parent, ID_KBD_B, wxT("b"), wxDefaultPosition, wxSize(32,32), 0 ); item41->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item41, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item42 = new wxButton( parent, ID_KBD_N, wxT("n"), wxDefaultPosition, wxSize(32,32), 0 ); item42->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item42, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item43 = new wxButton( parent, ID_KBD_M, wxT("m"), wxDefaultPosition, wxSize(32,32), 0 ); item43->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item36->Add( item43, 0, wxALIGN_CENTER|wxALL, 5 ); item34->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item44 = new wxButton( parent, ID_KBD_COMMA, wxT(","), wxDefaultPosition, wxSize(35,32), 0 ); item44->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item34->Add( item44, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item45 = new wxButton( parent, ID_KBD_PERIOD, wxT("."), wxDefaultPosition, wxSize(35,32), 0 ); item45->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item34->Add( item45, 0, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item34, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxFlexGridSizer *item46 = new wxFlexGridSizer( 7, 0, 0 ); wxButton *item47 = new wxButton( parent, ID_KBD_DELETE, wxT("backspace"), wxDefaultPosition, wxSize(50,32), 0 ); item47->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item46->Add( item47, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item48 = new wxButton( parent, ID_KBD_CLEAR, wxT("clear"), wxDefaultPosition, wxSize(50,32), 0 ); item48->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item46->Add( item48, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item49 = new wxButton( parent, ID_KBD_SPACE, wxT("space"), wxDefaultPosition, wxSize(95,32), 0 ); item49->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item46->Add( item49, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item50 = new wxButton( parent, ID_KBD_DONE, wxT("done"), wxDefaultPosition, wxSize(50,32), 0 ); item50->SetFont( wxFont( 20, wxROMAN, wxNORMAL, wxNORMAL ) ); item46->Add( item50, 0, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item46, 0, wxALIGN_CENTER|wxALL, 5 ); if (set_sizer) { parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); if (call_fit) { item0->Fit( parent ); item0->SetSizeHints( parent ); } } return item0; }
CStarNetServerFrame::CStarNetServerFrame(const wxString& title, const wxPoint& position, bool gui) : wxFrame(NULL, -1, title, position), #if defined(__WXDEBUG__) m_updates(true) #else m_updates(gui) #endif { SetMenuBar(createMenuBar()); wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL); wxPanel* panel = new wxPanel(this); wxBoxSizer* panelSizer = new wxBoxSizer(wxVERTICAL); wxStaticBoxSizer* log1Sizer = new wxStaticBoxSizer(new wxStaticBox(panel, -1, _("Log")), wxVERTICAL); wxBoxSizer* log2Sizer = new wxBoxSizer(wxVERTICAL); for (unsigned int i = 0U; i < 20U; i++) { m_logLine[i] = new wxStaticText(panel, -1, wxEmptyString, wxDefaultPosition, wxSize(LOGTEXT_WIDTH, -1)); m_logLine[i]->Wrap(LOGTEXT_WIDTH); log2Sizer->Add(m_logLine[i], 0, wxTOP | wxLEFT | wxRIGHT, BORDER_SIZE); } log1Sizer->Add(log2Sizer); panelSizer->Add(log1Sizer, 0, wxALL, BORDER_SIZE); panel->SetSizer(panelSizer); panelSizer->SetSizeHints(panel); mainSizer->Add(panel); SetSizer(mainSizer); mainSizer->SetSizeHints(this); } CStarNetServerFrame::~CStarNetServerFrame() { } wxMenuBar* CStarNetServerFrame::createMenuBar() { wxMenu* fileMenu = new wxMenu(); fileMenu->Append(wxID_EXIT, _("Exit")); wxMenu* editMenu = new wxMenu(); editMenu->Append(Menu_Edit_Preferences, _("Preferences...")); wxMenu* viewMenu = new wxMenu(); viewMenu->AppendCheckItem(Menu_View_Updates, _("GUI Updates")); viewMenu->Check(Menu_View_Updates, m_updates); wxMenu* helpMenu = new wxMenu(); helpMenu->Append(wxID_ABOUT, _("About StarNet Server")); wxMenuBar* menuBar = new wxMenuBar(); menuBar->Append(fileMenu, _("File")); menuBar->Append(editMenu, _("Edit")); menuBar->Append(viewMenu, _("View")); menuBar->Append(helpMenu, _("Help")); return menuBar; } void CStarNetServerFrame::onQuit(wxCommandEvent& event) { Close(false); }
wxSize wxDFBDCImpl::GetPPI() const { #warning "move this to common code?" return wxSize(int(double(m_mm_to_pix_x) * inches2mm), int(double(m_mm_to_pix_y) * inches2mm)); }
void S57QueryDialog::OnHtmlLinkClicked(wxHtmlLinkEvent &event) { S57ExtraQueryInfoDlg* ExtraObjInfoDlg = new S57ExtraQueryInfoDlg( GetParent(), wxID_ANY, _("Extra Object Info"), wxPoint(GetPosition().x+20, GetPosition().y+20 ), wxSize( g_S57_extradialog_sx, g_S57_extradialog_sy ) ); ExtraObjInfoDlg->m_phtml->LoadPage(event.GetLinkInfo().GetHref()); ExtraObjInfoDlg->SetColorScheme(); ExtraObjInfoDlg->Show(true); }