DIALOG_ENV_VAR_CONFIG::DIALOG_ENV_VAR_CONFIG( wxWindow* aParent, const ENV_VAR_MAP& aEnvVarMap ) :
    DIALOG_ENV_VAR_CONFIG_BASE( aParent )
{
    m_extDefsChanged = false;
    m_envVarMap = aEnvVarMap;

    m_grid->AppendRows( (int) m_envVarMap.size() );

    for( size_t row = 0;  row < m_envVarMap.size();  row++ )
    {
        wxGridCellTextEditor* editor = new wxGridCellTextEditor;
        ENVIRONMENT_VARIABLE_CHAR_VALIDATOR envVarValidator;
        editor->SetValidator( envVarValidator );
        m_grid->SetCellEditor( (int) row, 0, editor );

        editor = new wxGridCellTextEditor;
        FILE_NAME_WITH_PATH_CHAR_VALIDATOR pathValidator;
        editor->SetValidator( pathValidator );
        m_grid->SetCellEditor( (int) row, 1, editor );
    }

    wxButton* okButton = (wxButton*) FindWindowById( wxID_OK );

    if( okButton )
        SetDefaultItem( okButton );
}
Example #2
0
LTDialog_ChooseScen::LTDialog_ChooseScen(wxWindow *parent, wxString choices[], int nChoices)
  : wxDialog(parent, -1, wxT(STR_CHSSCN_TITLE), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxNO_DEFAULT | wxSTAY_ON_TOP)
{
	mainSizer = new wxBoxSizer(wxVERTICAL);
	buttonSizer = new wxBoxSizer(wxHORIZONTAL);

	radioBox = new wxRadioBox(this, wxID_ANY, wxT(STR_CHSSCN_RADIO), wxDefaultPosition, wxDefaultSize, nChoices, choices, 0, wxRA_SPECIFY_ROWS);

	mainSizer->AddSpacer(10);
	mainSizer->Add(radioBox, 1, wxALIGN_CENTER);

	okButton = new wxButton(this, wxID_OK, wxT(STR_OK));
	cancelButton = new wxButton(this, wxID_CANCEL, wxT(STR_CANCEL));

	buttonSizer->Add(okButton);
	buttonSizer->Add(cancelButton);

	mainSizer->AddSpacer(15);
	mainSizer->Add(buttonSizer, 1, wxALIGN_BOTTOM | wxALIGN_CENTER);
	mainSizer->AddSpacer(5);

	Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LTDialog_ChooseScen::onDone));
	Connect(wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(LTDialog_ChooseScen::onDone));
	Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(LTDialog_ChooseScen::onExit));

	mainSizer->SetMinSize(wxSize(300, 100));
	SetSizerAndFit(mainSizer);
	SetDefaultItem(okButton);
	Center();
} 
TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME* parent,
                                                                  PCB_TARGET* aTarget, wxDC* DC ) :
    TARGET_PROPERTIES_DIALOG_EDITOR_BASE( parent )
{
    m_Parent = parent;
    m_DC     = DC;
    m_Target = aTarget;

    // Size:
    m_staticTextSizeUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
    m_TargetSizeCtrl->SetValue( StringFromValue( g_UserUnit, m_Target->GetSize() ) );

    // Thickness:
    m_staticTextThicknessUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
    m_TargetThicknessCtrl->SetValue( StringFromValue( g_UserUnit, m_Target->GetWidth() ) );

    // Shape
    m_TargetShape->SetSelection( m_Target->GetShape() ? 1 : 0 );

    // OK button on return key.
    SetDefaultItem( m_sdbSizerButtsOK );

    FixOSXCancelButtonIssue();

    // Now all widgets have the size fixed, call FinishDialogSettings
    FinishDialogSettings();
}
Example #4
0
DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
                                                  DIMENSION* aDimension, wxDC* aDC ) :
    DIALOG_DIMENSION_EDITOR_BASE( aParent )
{
    SetFocus();

    m_Parent = aParent;
    m_DC = aDC;

    CurrentDimension = aDimension;

    if( aDimension->Text().IsMirrored() )
        m_rbMirror->SetSelection( 1 );
    else
        m_rbMirror->SetSelection( 0 );

    m_Name->SetValue( aDimension->Text().GetText() );

    // Enter size value in dialog
    PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->Text().GetSize().x );
    AddUnitSymbol( *m_staticTextSizeX );
    PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->Text().GetSize().y );
    AddUnitSymbol( *m_staticTextSizeY );

    // Enter lines thickness value in dialog
    PutValueInLocalUnits( *m_TxtWidthCtrl, aDimension->GetWidth() );
    AddUnitSymbol( *m_staticTextWidth );

    // Enter position value in dialog
    PutValueInLocalUnits( *m_textCtrlPosX, aDimension->Text().GetTextPosition().x );
    AddUnitSymbol( *m_staticTextPosX );
    PutValueInLocalUnits( *m_textCtrlPosY, aDimension->Text().GetTextPosition().y );
    AddUnitSymbol( *m_staticTextPosY );

    // Configure the layers list selector
    if( !m_Parent->GetBoard()->IsLayerEnabled( aDimension->GetLayer() ) )
        // Should not happens, because one cannot select a board item on a
        // not activated layer, but ...
        m_SelLayerBox->ShowNonActivatedLayers( true );

    m_SelLayerBox->SetLayersHotkeys( false );
    m_SelLayerBox->SetLayerSet( LSET::AllCuMask().set( Edge_Cuts ) );
    m_SelLayerBox->SetBoardFrame( m_Parent );
    m_SelLayerBox->Resync();

    if( m_SelLayerBox->SetLayerSelection( aDimension->GetLayer() ) < 0 )
    {
        wxMessageBox( _( "This item has an illegal layer id.\n"
                         "Now, forced on the drawings layer. Please, fix it" ) );
        m_SelLayerBox->SetLayerSelection( Dwgs_User );
    }

    SetDefaultItem( m_sdbSizerBtsOK );
    GetSizer()->Fit( this );
    GetSizer()->SetSizeHints( this );
    Centre();
}
Example #5
0
/// @brief DOCME
/// @param parent         
/// @param _local_manager 
///
DialogAutomation::DialogAutomation(wxWindow *parent, Automation4::ScriptManager *_local_manager)
: wxDialog(parent, -1, _("Automation Manager"), wxDefaultPosition, wxDefaultSize)
{
	// Set icon
	SetIcon(BitmapToIcon(GETIMAGE(automation_toolbutton_24)));

	local_manager = _local_manager;
	global_manager = wxGetApp().global_scripts;

	// create main controls
	list = new wxListView(this, Automation_List_Box, wxDefaultPosition, wxSize(600, 175), wxLC_REPORT|wxLC_SINGLE_SEL);
	add_button = new wxButton(this, Automation_Add_Script, _("&Add"));
	remove_button = new wxButton(this, Automation_Remove_Script, _("&Remove"));
	reload_button = new wxButton(this, Automation_Reload_Script, _("Re&load"));
	info_button = new wxButton(this, Automation_Show_Info, _("Show &Info"));
	reload_autoload_button = new wxButton(this, Automation_Reload_Autoload, _("Re&scan Autoload Dir"));
	close_button = new wxButton(this, wxID_CANCEL, _("&Close"));

	// add headers to list view
	list->InsertColumn(0, _T(""), wxLIST_FORMAT_CENTER, 20);
	list->InsertColumn(1, _("Name"), wxLIST_FORMAT_LEFT, 140);
	list->InsertColumn(2, _("Filename"), wxLIST_FORMAT_LEFT, 90);
	list->InsertColumn(3, _("Description"), wxLIST_FORMAT_LEFT, 330);

	// button layout
	wxSizer *button_box = new wxBoxSizer(wxHORIZONTAL);
	button_box->AddStretchSpacer(2);
	button_box->Add(add_button, 0);
	button_box->Add(remove_button, 0);
	button_box->AddSpacer(10);
	button_box->Add(reload_button, 0);
	button_box->Add(info_button, 0);
	button_box->AddSpacer(10);
	button_box->Add(reload_autoload_button, 0);
	button_box->AddSpacer(10);
	button_box->Add(new HelpButton(this,_T("Automation Manager")), 0);
	button_box->Add(close_button, 0);
	button_box->AddStretchSpacer(2);

	// main layout
	wxSizer *main_box = new wxBoxSizer(wxVERTICAL);
	main_box->Add(list, 1, wxEXPAND|wxALL, 5);
	main_box->Add(button_box, 0, wxEXPAND|(wxALL&~wxTOP), 5);
	main_box->SetSizeHints(this);
	SetSizer(main_box);
	Center();

	// why doesn't this work... the button gets the "default" decoration but doesn't answer to Enter
	// ("esc" does work)
	SetDefaultItem(close_button);
	SetAffirmativeId(wxID_CANCEL);
	close_button->SetDefault();

	RebuildList();
	UpdateDisplay();
}
Example #6
0
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    hThread = 0;
    // create command bar window
    HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
    // attach menu
    m_CmdBar.AttachMenu(GetMenu());
    // load command bar images
    m_CmdBar.LoadImages(IDR_MAINFRAME);
    // remove old menu
    SetMenu(NULL);

    HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(),
                                          MAKEINTRESOURCE(IDR_MAINFRAME),
                                          IMAGE_ICON,
                                          ::GetSystemMetrics(SM_CXSMICON),
                                          ::GetSystemMetrics(SM_CYSMICON),
                                          LR_DEFAULTCOLOR);

    InstallIcon(_T("Tooltip text"), hIconSmall, IDR_TRAYPOPUP);
    SetDefaultItem(ID_SHOW);


    HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);

    CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
    AddSimpleReBarBand(hWndCmdBar);
    AddSimpleReBarBand(hWndToolBar, NULL, TRUE);

    CreateSimpleStatusBar();

    WTL::CRect r(0, 0, 800, 600);

    m_hWndClient = m_view.Create(m_hWnd, r, NULL,
                                 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
                                 LBS_NOINTEGRALHEIGHT | LBS_NOTIFY | LBS_WANTKEYBOARDINPUT, WS_EX_CLIENTEDGE);

    m_view.SetFont(AtlGetDefaultGuiFont());

    UIAddToolBar(hWndToolBar);
    UISetCheck(ID_VIEW_TOOLBAR, 1);
    UISetCheck(ID_VIEW_STATUS_BAR, 1);

    // register object for message filtering and idle updates
    CMessageLoop* pLoop = _Module.GetMessageLoop();
    ATLASSERT(pLoop != NULL);
    pLoop->AddMessageFilter(this);
    pLoop->AddIdleHandler(this);

    return 0;
}
void __fastcall TImageViewerDemoMainForm::FormCreate(TObject *Sender)
{
  cdsFilms->LoadFromFile("..\\..\\Data\\Films.xml");
  cdsFilms->Open();
  cdsGenres->LoadFromFile("..\\..\\Data\\Genres.xml");
  cdsGenres->Open();
  cdsFilmsGenres->LoadFromFile("..\\..\\Data\\FilmsGenres.xml");
  cdsFilmsGenres->Open();

  miBottomSide->Click();
  miAutoColumnCount->Click();
  tbItemSize->Position = 3;

  PopulateGallery(cbSorted->Checked);
  SetDefaultItem();
}
Example #8
0
// 初期化を行う
void CNickChangeDialog::init(wxWindow* parent, const wxString& title)
{
    wxDialog::Create(parent, wxID_ANY, title);

    // 自身に貼り付けるパネルを作成
    wxPanel* panel = new wxPanel(this, wxID_ANY);

    // パネル上のテキストボックス
    m_nickText = new wxTextCtrl(
        panel, wxID_ANY, "", wxPoint(100, 50), wxSize(100, 30));

    // パネル上の文字
    wxStaticText* sChannel = new wxStaticText(
        panel, wxID_ANY, "ニックネーム", wxPoint(10, 50));

    // パネル上のボタン
    wxButton* ok = new wxButton(panel, wxID_OK, "OK",  wxPoint(250, 150));

    // Escで消した時の挙動
    SetEscapeId(wxID_CANCEL);

    // エンターキー押下時の挙動
    SetDefaultItem(ok);
}
Example #9
0
void MadReplaceDialog::CreateGUIControls(void)
{
    //do not set FontName, it is not exist on all platforms
    #define wxFont(p0,p1,p2,p3,p4,p5) wxFont(wxDEFAULT,wxDEFAULT,p2,p3,p4)

    //Do not add custom Code here
    //wx-devcpp designer will remove them.
    //Add the custom code before or after the Blocks
    ////GUI Items Creation Start

	WxBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
	this->SetSizer(WxBoxSizer1);
	this->SetAutoLayout(true);

	WxBoxSizer2 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer1->Add(WxBoxSizer2, 0, wxALIGN_CENTER | wxALL, 0);

	WxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
	WxBoxSizer2->Add(WxBoxSizer4, 0, wxALIGN_CENTER | wxALL, 0);

	WxBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
	WxBoxSizer2->Add(WxBoxSizer5, 0, wxALIGN_CENTER | wxALL, 0);

	WxBoxSizer6 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer2->Add(WxBoxSizer6, 0, wxALIGN_LEFT | wxALIGN_TOP | wxALL, 0);

	WxCheckBoxMoveFocus = new wxCheckBox(this, ID_WXCHECKBOXMOVEFOCUS, _("&Move Focus to Editor Window"), wxPoint(25, 2), wxSize(300, 22), 0, wxDefaultValidator, _("WxCheckBoxMoveFocus"));
	WxCheckBoxMoveFocus->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxCheckBoxMoveFocus,0,wxALIGN_LEFT | wxALL,2);

	WxCheckBoxCaseSensitive = new wxCheckBox(this, ID_WXCHECKBOXCASESENSITIVE, _("&Case Sensitive"), wxPoint(25, 28), wxSize(300, 22), 0, wxDefaultValidator, _("WxCheckBoxCaseSensitive"));
	WxCheckBoxCaseSensitive->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxCheckBoxCaseSensitive,0,wxALIGN_LEFT | wxALL,2);

	WxCheckBoxWholeWord = new wxCheckBox(this, ID_WXCHECKBOXWHOLEWORD, _("&Whole Word Only"), wxPoint(25, 54), wxSize(300, 22), 0, wxDefaultValidator, _("WxCheckBoxWholeWord"));
	WxCheckBoxWholeWord->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxCheckBoxWholeWord,0,wxALIGN_LEFT | wxALL,2);

	WxCheckBoxRegex = new wxCheckBox(this, ID_WXCHECKBOXREGEX, _("Use Regular E&xpressions"), wxPoint(25, 80), wxSize(300, 22), 0, wxDefaultValidator, _("WxCheckBoxRegex"));
	WxCheckBoxRegex->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxCheckBoxRegex,0,wxALIGN_LEFT | wxALL,2);

	WxCheckBoxFindHex = new wxCheckBox(this, ID_WXCHECKBOXFINDHEX, _("Find &Hex String (Example: BE 00 3A or BE003A)"), wxPoint(25, 106), wxSize(300, 22), 0, wxDefaultValidator, _("WxCheckBoxFindHex"));
	WxCheckBoxFindHex->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxCheckBoxFindHex,0,wxALIGN_LEFT | wxALL,2);

	WxBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
	WxBoxSizer6->Add(WxBoxSizer7, 0, wxALIGN_LEFT | wxALL, 0);

	WxCheckBoxSearchInSelection = new wxCheckBox(this, ID_WXCHECKBOXSEARCHINSELECTION, _("Search In &Selection"), wxPoint(2, 2), wxSize(120, 22), 0, wxDefaultValidator, _("WxCheckBoxSearchInSelection"));
	WxCheckBoxSearchInSelection->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxCheckBoxSearchInSelection,0,wxALIGN_LEFT | wxALL,2);

	WxStaticTextFrom = new wxStaticText(this, ID_WXSTATICTEXTFROM, _("From:"), wxPoint(126, 4), wxDefaultSize, 0, _("WxStaticTextFrom"));
	WxStaticTextFrom->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxStaticTextFrom,0,wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,2);

	WxEditFrom = new wxTextCtrl(this, ID_WXEDITFROM, _(""), wxPoint(160, 2), wxSize(80, 22), 0, wxDefaultValidator, _("WxEditFrom"));
	WxEditFrom->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxEditFrom,0,wxALIGN_LEFT | wxALL,2);

	WxStaticTextTo = new wxStaticText(this, ID_WXSTATICTEXTTO, _("To:"), wxPoint(244, 4), wxDefaultSize, 0, _("WxStaticTextTo"));
	WxStaticTextTo->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxStaticTextTo,0,wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,2);

	WxEditTo = new wxTextCtrl(this, ID_WXEDITTO, _(""), wxPoint(268, 2), wxSize(80, 22), 0, wxDefaultValidator, _("WxEditTo"));
	WxEditTo->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxEditTo,0,wxALIGN_LEFT | wxALL,2);

	WxBoxSizer3 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer1->Add(WxBoxSizer3, 0, wxALIGN_TOP | wxALL, 0);

	WxButtonFindNext = new wxButton(this, ID_WXBUTTONFINDNEXT, _("Find &Next"), wxPoint(2, 2), wxSize(100, 28), 0, wxDefaultValidator, _("WxButtonFindNext"));
	WxButtonFindNext->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer3->Add(WxButtonFindNext,0,wxALIGN_CENTER | wxALL,2);

	WxButtonReplace = new wxButton(this, ID_WXBUTTONREPLACE, _("&Replace"), wxPoint(2, 34), wxSize(100, 28), 0, wxDefaultValidator, _("WxButtonReplace"));
	WxButtonReplace->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer3->Add(WxButtonReplace,0,wxALIGN_CENTER | wxALL,2);

	WxButtonReplaceAll = new wxButton(this, ID_WXBUTTONREPLACEALL, _("Replace &All"), wxPoint(2, 66), wxSize(100, 28), 0, wxDefaultValidator, _("WxButtonReplaceAll"));
	WxButtonReplaceAll->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer3->Add(WxButtonReplaceAll,0,wxALIGN_CENTER | wxALL,2);

	WxButtonClose = new wxButton(this, ID_WXBUTTONCLOSE, _("Close"), wxPoint(2, 96), wxSize(100, 28), 0, wxDefaultValidator, _("WxButtonClose"));
	WxButtonClose->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer3->Add(WxButtonClose,0,wxALIGN_CENTER | wxALL,2);

	WxPopupMenuRecentReplaceText = new wxMenu(_(""));

	SetTitle(_("Replace"));
	SetIcon(wxNullIcon);
	
	GetSizer()->Layout();
	GetSizer()->Fit(this);
	GetSizer()->SetSizeHints(this);
	
    ////GUI Items Creation End

    //restore wxFont
    #undef wxFont

    this->SetPosition(wxPoint(300,100));

    int bw, bh;
    // find
    WxButtonFindNext->GetSize(&bw, &bh);

    m_FindText=new MadEdit(this, ID_MADEDIT1, wxPoint(0, 0), wxSize(400, bh));
    m_FindText->SetSingleLineMode(true);
    m_FindText->SetEncoding(wxT("UTF-32LE"));
    m_FindText->SetFixedWidthMode(false);
    m_FindText->SetRecordCaretMovements(false);
    m_FindText->SetInsertSpacesInsteadOfTab(false);
    m_FindText->SetWantTab(false);
    m_FindText->LoadDefaultSyntaxScheme();

    WxBoxSizer4->Add(m_FindText,0,wxALIGN_CENTER_HORIZONTAL | wxALL,2);
    WxBoxSizer4->SetItemMinSize(m_FindText, 400, bh);

    wxBitmap WxBitmapButtonRecentFindText_BITMAP (down_xpm);
    WxBitmapButtonRecentFindText = new wxBitmapButton(this, ID_WXBITMAPBUTTONRECENTFINDTEXT, WxBitmapButtonRecentFindText_BITMAP, wxPoint(0,0), wxSize(bh,bh), wxBU_AUTODRAW, wxDefaultValidator, _("WxBitmapButtonRecentFindText"));
    WxBoxSizer4->Add(WxBitmapButtonRecentFindText,0,wxALIGN_CENTER_HORIZONTAL | wxALL,2);

    // replace
    WxButtonReplace->GetSize(&bw, &bh);

    m_ReplaceText=new MadEdit(this, ID_MADEDIT2, wxPoint(0, 0), wxSize(400, bh));
    m_ReplaceText->SetSingleLineMode(true);
    m_ReplaceText->SetEncoding(wxT("UTF-32LE"));
    m_ReplaceText->SetFixedWidthMode(false);
    m_ReplaceText->SetRecordCaretMovements(false);
    m_ReplaceText->SetInsertSpacesInsteadOfTab(false);
    m_ReplaceText->SetWantTab(false);
    m_ReplaceText->LoadDefaultSyntaxScheme();

    WxBoxSizer5->Add(m_ReplaceText,0,wxALIGN_CENTER_HORIZONTAL | wxALL,2);
    WxBoxSizer5->SetItemMinSize(m_ReplaceText, 400, bh);

    WxBitmapButtonRecentReplaceText = new wxBitmapButton(this, ID_WXBITMAPBUTTONRECENTREPLACETEXT, WxBitmapButtonRecentFindText_BITMAP, wxPoint(0,0), wxSize(bh,bh), wxBU_AUTODRAW, wxDefaultValidator, _("WxBitmapButtonRecentReplaceText"));
    WxBoxSizer5->Add(WxBitmapButtonRecentReplaceText,0,wxALIGN_CENTER_HORIZONTAL | wxALL,2);

    // resize checkbox
    ResizeItem(WxBoxSizer6, WxCheckBoxMoveFocus, 25, 4);
    ResizeItem(WxBoxSizer6, WxCheckBoxCaseSensitive, 25, 4);
    ResizeItem(WxBoxSizer6, WxCheckBoxWholeWord, 25, 4);
    ResizeItem(WxBoxSizer6, WxCheckBoxRegex, 25, 4);
    ResizeItem(WxBoxSizer6, WxCheckBoxFindHex, 25, 4);
    ResizeItem(WxBoxSizer7, WxCheckBoxSearchInSelection, 25, 4);
    ResizeItem(WxBoxSizer7, WxStaticTextFrom, 2, 2);
    ResizeItem(WxBoxSizer7, WxStaticTextTo, 2, 2);

    GetSizer()->Fit(this);

    // connect to KeyDown event handler
    m_FindText->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    m_ReplaceText->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxBitmapButtonRecentFindText->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxBitmapButtonRecentReplaceText->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxCheckBoxMoveFocus->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxCheckBoxCaseSensitive->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxCheckBoxWholeWord->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxCheckBoxRegex->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxCheckBoxFindHex->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxCheckBoxSearchInSelection->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxStaticTextFrom->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxStaticTextTo->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxButtonFindNext->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxButtonReplace->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxButtonReplaceAll->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));
    WxButtonClose->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MadReplaceDialog::MadReplaceDialogKeyDown));


    m_RecentReplaceText=new wxFileHistory(20, ID_RECENTREPLACETEXT1);
    m_RecentReplaceText->UseMenu(WxPopupMenuRecentReplaceText);

    wxConfigBase *m_Config=wxConfigBase::Get(false);
    wxString oldpath=m_Config->GetPath();
    m_Config->SetPath(wxT("/RecentReplaceText"));
    m_RecentReplaceText->Load(*m_Config);
    m_Config->SetPath(oldpath);


    if(g_SearchDialog!=NULL)
    {
        wxString text;
        g_SearchDialog->m_FindText->GetText(text, true);
        m_FindText->SetText(text);
    }

    if(m_RecentReplaceText->GetCount()>0)
    {
        wxString text=m_RecentReplaceText->GetHistoryFile(0);
        if(!text.IsEmpty())
        {
            m_ReplaceText->SetText(text);
        }
    }

    SetDefaultItem(WxButtonReplace);

}
Example #10
0
RemoteProfileDlg::RemoteProfileDlg(wxWindow *parent, eSettings& settings):
	wxDialog (parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER),
	m_settings(settings), m_currentProfile(-1) 
{
	SetTitle (_("Remote Profiles"));

	wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
	{
		wxBoxSizer* profileSizer = new wxBoxSizer(wxHORIZONTAL);
		{
			wxBoxSizer* listSizer = new wxBoxSizer(wxVERTICAL);
			{
				m_profileList = new wxListBox(this, CTRL_PROFILELIST);
				listSizer->Add(m_profileList, 1, wxEXPAND|wxALL, 5);

				wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
				{
					wxButton* newButton = new wxButton(this, CTRL_BUTTON_NEW, _("New Profile"));
					newButton->SetToolTip(_("Create new profile for remote project"));
					m_deleteButton = new wxButton(this, CTRL_BUTTON_DELETE, _("Delete"));
					m_deleteButton->SetToolTip(_("Delete profile"));
					buttonSizer->Add(newButton, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
					buttonSizer->Add(m_deleteButton, 0, wxALIGN_RIGHT|wxRIGHT, 5);

					m_deleteButton->Enable(false);

					listSizer->Add(buttonSizer, 0, wxALIGN_RIGHT);
				}

				profileSizer->Add(listSizer, 1, wxEXPAND|wxRIGHT, 5);
			}

			// Create the notebook
			wxNotebook* notebook = new wxNotebook(this, wxID_ANY);
			{
				// Create the general settings page
				wxPanel* settingsPage = new wxPanel(notebook, wxID_ANY);
				{
					wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2,2, 0, 0);
					{
						gridSizer->AddGrowableCol(1); // col 2 is sizable

						wxStaticText* labelName = new wxStaticText(settingsPage, wxID_ANY, _("Name:"));
						gridSizer->Add(labelName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
						m_profileName = new wxTextCtrl(settingsPage, CTRL_TEXT_NAME);
						m_profileName->SetToolTip(_("Profile name"));
						gridSizer->Add(m_profileName, 1, wxEXPAND|wxALL, 5);

						wxStaticText* labelAddress = new wxStaticText(settingsPage, wxID_ANY, _("Address:"));
						gridSizer->Add(labelAddress, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
						m_profileAddress = new wxTextCtrl(settingsPage, wxID_ANY);
						m_profileAddress->SetToolTip(_("Remote address. (eg. ftp.mydomain.com)"));
						gridSizer->Add(m_profileAddress, 1, wxEXPAND|wxALL, 5);

						wxStaticText* labelDir = new wxStaticText(settingsPage, wxID_ANY, _("Directory:"));
						gridSizer->Add(labelDir, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
						m_profileDir = new wxTextCtrl(settingsPage, wxID_ANY);
						m_profileDir->SetToolTip(_("Base dir for project. (eg. /user/www/)"));
						gridSizer->Add(m_profileDir, 1, wxEXPAND|wxALL, 5);

						wxStaticText* labelUsername = new wxStaticText(settingsPage, wxID_ANY, _("Username:"******"Username for login (leave empty for anonymous)."));
						gridSizer->Add(m_profileUsername, 1, wxEXPAND|wxALL, 5);

						wxStaticText* labelPassword = new wxStaticText(settingsPage, wxID_ANY, _("Password:"******""), wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
						m_profilePassword->SetToolTip(_("Password for login (leave empty for anonymous)."));
						gridSizer->Add(m_profilePassword, 1, wxEXPAND|wxALL, 5);

						settingsPage->SetSizerAndFit(gridSizer);
					}

					notebook->AddPage(settingsPage, _("General"), true);
				}

				profileSizer->Add(notebook, 2, wxEXPAND);
			}

			mainSizer->Add(profileSizer, 1, wxEXPAND|wxALL, 5);
		}

		wxBoxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
		{
			m_openButton = new wxButton(this, CTRL_BUTTON_OPEN, _("Open"));
			wxButton* cancelButton = new wxButton(this, wxID_CANCEL, _("Cancel"));
			buttonSizer->Add(m_openButton, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5);
			buttonSizer->Add(cancelButton, 0, wxALIGN_RIGHT|wxRIGHT, 5);

			mainSizer->Add(buttonSizer, 0, wxALIGN_RIGHT|wxBOTTOM, 5);
		}
	}

	SetDefaultItem(m_openButton);
	Init();

	SetSizerAndFit(mainSizer);
	Centre();
}
Example #11
0
InputBox::InputBox(wxWindow* parent, const OptionDict& options, bool doFloat) 
: wxDialog(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, doFloat ? wxDEFAULT_DIALOG_STYLE|wxSTAY_ON_TOP : wxDEFAULT_DIALOG_STYLE), m_options(options) {
	// Set the dialog title
	const wxString title = options.GetOption(wxT("title"));
	SetTitle(options.GetOption(wxT("title")));

	wxSize textSize = wxDefaultSize;

	int textStyle = 0;
	if (options.HasOption(wxT("no-show"))) textStyle |= wxTE_PASSWORD;

	//Set textStyle to multiline, in case runmode is textbox
	const wxString runmode = options.GetRunmode();
	if (runmode == wxT("textbox")) 
	{
		textSize = wxSize(-1,250);
		textStyle |= wxTE_MULTILINE|wxTE_READONLY;
	}
	
	// Create controls
	wxStaticText* informativeText = new wxStaticText(this, wxID_ANY, options.GetOption(wxT("informative-text")));
	m_inputBox = new wxTextCtrl(this, wxID_ANY, options.GetOption(wxT("text")), wxDefaultPosition, textSize, textStyle);

	//Set text selected
	m_inputBox->SetSelection(5,7);

	//Set cursor at last position
	if (options.GetOption(wxT("scroll-to")) == wxT("bottom")) m_inputBox->ShowPosition(m_inputBox->GetLastPosition());
	
	//Set text editable
	if (options.HasOption(wxT("editable"))) m_inputBox->SetEditable(true);

	//Load text from file
	if (options.HasOption(wxT("text-from-file")))
	{
		const wxString textFromFile = options.GetOption(wxT("text-from-file"));
		m_inputBox->LoadFile(textFromFile);
	}

	m_inputBox->SetInsertionPoint(0);

	m_button3 = new wxButton(this, CTRL_BUTTON3, options.GetOption(wxT("button3")));
	m_button2 = new wxButton(this, CTRL_BUTTON2, options.GetOption(wxT("button2")));
	m_button1 = new wxButton(this, CTRL_BUTTON1, options.GetOption(wxT("button1")));
	SetDefaultItem(m_button1);

	// Create layout
	wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
		mainSizer->Add(informativeText, 0, wxALL, 5);
		mainSizer->Add(m_inputBox, 0, wxEXPAND|wxALL, 5);
		wxSizer* buttonSizer = new wxBoxSizer(wxHORIZONTAL);
			buttonSizer->Add(m_button3, 0, wxALL, 5);
			buttonSizer->Add(m_button2, 0, wxALL, 5);
			buttonSizer->Add(m_button1, 0, wxALL, 5);
			mainSizer->Add(buttonSizer, 0, wxALIGN_RIGHT);

	// Hide unneeded controls
	if (!options.HasOption(wxT("informative-text"))) mainSizer->Hide(informativeText);
	if (!options.HasOption(wxT("button2"))) buttonSizer->Hide(m_button2);
	if (!options.HasOption(wxT("button3"))) buttonSizer->Hide(m_button3);

	// Set timeout timer
	int interval;
	if (options.GetIntegerOption(wxT("timeout"), interval)) {
		m_timer.SetOwner(this, TIMEOUT_TIMER);
		m_timer.Start(interval*1000, true);
	}
	
	SetSizerAndFit(mainSizer);
	
	// Make sure dialog does not get too small
	const wxSize size = GetSize();
	if (size.x < 300) SetSize(300, -1);

	Centre();
	Show();
}
Example #12
0
AnnotateDialog::AnnotateDialog(wxWindow* parent, const std::string& filename, const std::string& rev)
   : ExtDialog(parent, -1, wxString(_("TortoiseCVS - Annotate")),
               wxDefaultPosition, wxSize(500,400),
               wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX),
     myFilename(filename),
     mySortCol(ANNOTATE_COL_LINE),
     mySortAscending(true),
     myLineColors(0),
     myHighlightType(HIGHLIGHT_BY_NONE),
     myRevision(rev),
     myGotLogMessages(false),
     myShowLogMessages(false),
     myFindDialog(0),
     myFoundLineIndex(std::numeric_limits<unsigned int>::max())
{
    TDEBUG_ENTER("AnnotateDialog");
   SetIcon(wxIcon(wxT("A_TORTOISE"), wxBITMAP_TYPE_ICO_RESOURCE));

   wxString sTitle = GetTitle();
   sTitle += wxT(" ");
   sTitle += wxText(ExtractLastPart(filename));
   if (!rev.empty())
   {
      sTitle += wxT(" (");
      sTitle += wxText(rev);
      sTitle += wxT(")");
   }
   SetTitle(sTitle);

   myAnnotateCanvas = new AnnotateCanvas(this, -1, wxDefaultPosition, wxSize(10,10));
   // List control    
   myListCtrl = new AnnotateListCtrl(this, ANNOTATEDLG_ID_LISTCTRL, myAnnotateCanvas);

   int idx = 0;
   myListCtrl->InsertColumn(idx++, _("Line"),      wxLIST_FORMAT_LEFT);
   myListCtrl->InsertColumn(idx++, _("Revision"),  wxLIST_FORMAT_LEFT);
   myListCtrl->InsertColumn(idx++, _("Author"),    wxLIST_FORMAT_LEFT);
   myListCtrl->InsertColumn(idx++, _("Date"),      wxLIST_FORMAT_LEFT);
#if 0
   myListCtrl->InsertColumn(idx++, _("Bug Number"),wxLIST_FORMAT_LEFT);
#endif
   myListCtrl->InsertColumn(idx++, _("Text"),      wxLIST_FORMAT_LEFT);

   myFixedFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT); 

   wxBoxSizer *sizerAnnotate = new wxBoxSizer(wxHORIZONTAL);
   sizerAnnotate->Add(myListCtrl, 3, wxGROW | wxALL, 3);

   wxBoxSizer* sizerCanvas = new wxBoxSizer(wxVERTICAL);
   sizerCanvas->Add(myAnnotateCanvas, 1, wxGROW | wxTOP | wxBOTTOM, 21);
   sizerCanvas->Add(10, 19);

   sizerAnnotate->Add(sizerCanvas, 0, wxGROW);

   wxBoxSizer *sizer1 = new wxBoxSizer(wxVERTICAL);
   sizer1->Add(sizerAnnotate, 3, wxGROW | wxLEFT | wxUP | wxDOWN, 3);

   // OK button
   wxBoxSizer *sizerConfirm = new wxBoxSizer(wxHORIZONTAL);
   wxButton* buttonOK = new wxButton(this, wxID_OK, _("OK"));
   buttonOK->SetDefault();
   sizerConfirm->Add(buttonOK, 0, wxALL, 5);
   wxButton* buttonSearch = new wxButton(this, wxID_FIND, _("&Find"));
   sizerConfirm->Add(buttonSearch, 0, wxALL, 5);
   SetDefaultItem(buttonOK);

   // Hidden Cancel button (only for making Esc close the dialog)
   wxButton* cancel = new wxButton(this, wxID_CANCEL, wxT(""));
   cancel->Hide();

   // Status bar
   myStatusBar = new wxStatusBar(this, -1);

   // Main box with everything in it
   wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
   sizerTop->Add(sizer1, 2, wxGROW | 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, "Annotate", wxSize(500, 400));
   SetTortoiseDialogPos(this, GetRemoteHandle());
   RestoreTortoiseDialogState(this, "Annotate");

   GetRegistryData();
   UpdateStatusBar();

   // Get column widths from registry (if not outdated)
   unsigned int numSavedColumns = static_cast<unsigned int>(myColumnWidths.size());
   if (numSavedColumns == NUM_ANNOTATE_COL)
   {
       for (unsigned int i = 0; i < NUM_ANNOTATE_COL; ++i)
       {
           int colWidth = (i < numSavedColumns) ? myColumnWidths[i] : DEF_COLUMN_SIZE[i];
           if (colWidth <= 0 || colWidth > MAX_COLUMN_SIZE)
               colWidth = DEF_COLUMN_SIZE[i];
           
           myListCtrl->SetColumnWidth(i, wxDLG_UNIT_X(this, colWidth));
       }
   }
}
void MadFileAssociationDialog::CreateGUIControls()
{
    //do not set FontName, it is not exist on all platforms
    #define wxFont(p0,p1,p2,p3,p4,p5) wxFont(wxDEFAULT,wxDEFAULT,p2,p3,p4)

	//Do not add custom code between
	//GUI Items Creation Start and GUI Items Creation End.
	//wxDev-C++ designer will remove them.
	//Add the custom code before or after the blocks
	////GUI Items Creation Start

	WxBoxSizer1 = new wxBoxSizer(wxVERTICAL);
	this->SetSizer(WxBoxSizer1);
	this->SetAutoLayout(true);

	WxBoxSizer2 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer1->Add(WxBoxSizer2, 0, wxALIGN_CENTER | wxALL, 5);

	WxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
	WxBoxSizer2->Add(WxBoxSizer4, 0, wxALIGN_CENTER | wxALL, 0);

	WxBoxSizer6 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer4->Add(WxBoxSizer6, 0, wxALIGN_CENTER | wxALL, 5);

	WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, _("Associated File Types:"), wxPoint(10, 5), wxDefaultSize, 0, _("WxStaticText1"));
	WxStaticText1->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxStaticText1,0,wxALIGN_CENTER | wxALL,5);

	wxArrayString arrayStringFor_WxListBoxAssociated;
	WxListBoxAssociated = new wxListBox(this, ID_WXLISTBOXASSOCIATED, wxPoint(5, 32), wxSize(121, 200), arrayStringFor_WxListBoxAssociated, wxLB_EXTENDED);
	WxListBoxAssociated->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer6->Add(WxListBoxAssociated,0,wxALIGN_CENTER | wxALL,5);

	WxBoxSizer7 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer4->Add(WxBoxSizer7, 0, wxALIGN_CENTER | wxALL, 5);

	WxButtonAdd = new wxButton(this, ID_WXBUTTONADD, _("<- Add"), wxPoint(5, 5), wxSize(100, 30), 0, wxDefaultValidator, _("WxButtonAdd"));
	WxButtonAdd->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxButtonAdd,0,wxALIGN_CENTER | wxALL,5);

	WxButtonRemove = new wxButton(this, ID_WXBUTTONREMOVE, _("Remove ->"), wxPoint(5, 45), wxSize(100, 30), 0, wxDefaultValidator, _("WxButtonRemove"));
	WxButtonRemove->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer7->Add(WxButtonRemove,0,wxALIGN_CENTER | wxALL,5);

	WxBoxSizer8 = new wxBoxSizer(wxVERTICAL);
	WxBoxSizer4->Add(WxBoxSizer8, 0, wxALIGN_CENTER | wxALL, 5);

	WxStaticText2 = new wxStaticText(this, ID_WXSTATICTEXT2, _("Predefined File Types:"), wxPoint(11, 5), wxDefaultSize, 0, _("WxStaticText2"));
	WxStaticText2->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer8->Add(WxStaticText2,0,wxALIGN_CENTER | wxALL,5);

	wxArrayString arrayStringFor_WxListBoxPredefined;
	WxListBoxPredefined = new wxListBox(this, ID_WXLISTBOXPREDEFINED, wxPoint(5, 32), wxSize(121, 200), arrayStringFor_WxListBoxPredefined, wxLB_EXTENDED);
	WxListBoxPredefined->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer8->Add(WxListBoxPredefined,0,wxALIGN_CENTER | wxALL,5);

	WxBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
	WxBoxSizer2->Add(WxBoxSizer5, 0, wxALIGN_LEFT | wxALL, 5);

	WxEditCustomType = new wxTextCtrl(this, ID_WXEDITCUSTOMTYPE, _(""), wxPoint(5, 5), wxSize(121, 30), 0, wxDefaultValidator, _("WxEditCustomType"));
	WxEditCustomType->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer5->Add(WxEditCustomType,0,wxALIGN_LEFT | wxALL,5);

	WxButtonAddCustom = new wxButton(this, ID_WXBUTTONADDCUSTOM, _("<- Add Custom File Type"), wxPoint(136, 5), wxSize(175, 30), 0, wxDefaultValidator, _("WxButtonAddCustom"));
	WxButtonAddCustom->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer5->Add(WxButtonAddCustom,0,wxALIGN_LEFT | wxALL,5);

	WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
	WxBoxSizer1->Add(WxBoxSizer3, 0, wxALIGN_CENTER | wxALL, 5);

	WxButtonOK = new wxButton(this, ID_WXBUTTONOK, _("&OK"), wxPoint(14, 5), wxSize(85, 30), 0, wxDefaultValidator, _("WxButtonOK"));
	WxButtonOK->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer3->Add(WxButtonOK,0,wxALIGN_CENTER | wxALL,5);

	WxButtonCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"), wxPoint(100, 5), wxSize(90, 30), 0, wxDefaultValidator, _("WxButtonCancel"));
	WxButtonCancel->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif")));
	WxBoxSizer3->Add(WxButtonCancel,0,wxALIGN_CENTER | wxALL,5);

	SetTitle(_("File Type Associations"));
	SetIcon(wxNullIcon);
	
	GetSizer()->Layout();
	GetSizer()->Fit(this);
	GetSizer()->SetSizeHints(this);
	Center();
	
	////GUI Items Creation End

    //restore wxFont
    #undef wxFont

    wxArrayString as_predefined(g_PredefinedTypes_Count, g_PredefinedTypes);

    wxConfigBase *cfg=wxConfigBase::Get(false);
    wxString oldpath=cfg->GetPath();
    cfg->SetPath(wxT("/AssociatedFileTypes"));

    int idx=0, idx2;
    wxString type;
    while(cfg->Read(wxString()<<idx, &type))
    {
        if(DetectType(type))
        {
            WxListBoxAssociated->Append(type);
            if((idx2=as_predefined.Index(type.c_str()))!=wxNOT_FOUND)
            {
                as_predefined.RemoveAt(idx2);
            }
        }
        ++idx;
    }

    WxListBoxPredefined->Set(as_predefined);

    cfg->SetPath(oldpath);


    ResizeItem(WxBoxSizer6, WxStaticText1, 2, 2);
    ResizeItem(WxBoxSizer8, WxStaticText2, 2, 2);


    SetDefaultItem(WxButtonCancel);
    WxButtonCancel->SetFocus();
}
Example #14
0
AGE_OpenDialog::AGE_OpenDialog(wxWindow *parent, const wxFont &font)
: AGE_OpenSave(parent, "Open", this, font)
{
    SolidText *TerrainsText = new SolidText(this, "      Terrains: ");
    TerrainsBox = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(50, -1));
    Path_DatFileLocation = new wxFilePickerCtrl(this, wxID_ANY, "", "Select a file", "Compressed data set (*.dat)|*.dat", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN | wxFLP_USE_TEXTCTRL | wxFLP_FILE_MUST_EXIST);
    Button_RawDecompress = new wxButton(this, wxID_ANY, "Decompress only", wxDefaultPosition, wxSize(5, -1));
    Path_RawDecompress = new wxFilePickerCtrl(this, wxID_ANY, "", "Select a file", "Compressed genie file|*", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN | wxFLP_USE_TEXTCTRL | wxFLP_FILE_MUST_EXIST);

    Path_LangFileLocation = new wxFilePickerCtrl(this, wxID_ANY, "", "Select a file", "DLL or text (*.dll, *.txt)|*.dll;*.txt", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN | wxFLP_USE_TEXTCTRL | wxFLP_FILE_MUST_EXIST);
    Path_LangX1FileLocation = new wxFilePickerCtrl(this, wxID_ANY, "", "Select a file", "DLL or text (*.dll, *.txt)|*.dll;*.txt", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN | wxFLP_USE_TEXTCTRL | wxFLP_FILE_MUST_EXIST);
    Path_LangX1P1FileLocation = new wxFilePickerCtrl(this, wxID_ANY, "", "Select a file", "DLL or text (*.dll, *.txt)|*.dll;*.txt", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN | wxFLP_USE_TEXTCTRL | wxFLP_FILE_MUST_EXIST);
    CheckBox_LangWrite = new wxCheckBox(this, wxID_ANY, "Write language files *");
    CheckBox_LangWrite->SetToolTip("WARNING! This feature is still experimental\nand affects reading too");
    CheckBox_LangWrite->SetBackgroundColour(wxColour(240, 200, 200));
    CheckBox_LangWriteToLatest = new wxCheckBox(this, wxID_ANY, "Write to the latest file instead of the base file *      Google Resource Hacker or Resource Tuner");
    CheckBox_LangWriteToLatest->SetToolTip("If you write to the latest file (x1/p1),\nyou only need to distribute that file,\nbut your edits will not affect the vanilla game");
    CheckBox_DRSPath = new AGE_PairedCheckBox(this, "Path for DRS files *", (wxWindow**)&Path_DRS);
    CheckBox_DRSPath->SetToolTip("Path to the folder containing all drs files/folders");
    CheckBox_DRSPath2 = new AGE_PairedCheckBox(this, "Path for mod DRS files", (wxWindow**)&Path_DRS2);
    CheckBox_DRSPath3 = new AGE_PairedCheckBox(this, "Extra 1st priority DRS file", (wxWindow**)&Path_DRS3);
    CheckBox_SlpPath = new AGE_PairedCheckBox(this, "Path for loose SLP files", (wxWindow**)&Path_SLP);
    Path_DRS = new wxDirPickerCtrl(this, wxID_ANY, "", "Select a folder", wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST);
    Path_DRS2 = new wxDirPickerCtrl(this, wxID_ANY, "", "Select a folder", wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST);
    Path_DRS3 = new wxFilePickerCtrl(this, wxID_ANY, "", "Select a file", "DRS (*.drs)|*.drs", wxDefaultPosition, wxDefaultSize, wxFLP_OPEN | wxFLP_USE_TEXTCTRL | wxFLP_FILE_MUST_EXIST);
    Path_SLP = new wxDirPickerCtrl(this, wxID_ANY, "", "Select a folder", wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL | wxDIRP_DIR_MUST_EXIST);

    Extras->Add(TerrainsText);
    Extras->Add(TerrainsBox);
    Layout->Add(Path_DatFileLocation, 1, wxEXPAND);
    Layout->Add(Button_RawDecompress, 1, wxEXPAND);
    Layout->Add(Path_RawDecompress, 1, wxEXPAND);
    Layout->AddSpacer(15);
    Layout->AddSpacer(15);
    Layout->Add(CheckBox_LangFileLocation, 1, wxEXPAND);
    Layout->Add(Path_LangFileLocation, 1, wxEXPAND);
    Layout->Add(CheckBox_LangX1FileLocation, 1, wxEXPAND);
    Layout->Add(Path_LangX1FileLocation, 1, wxEXPAND);
    Layout->Add(CheckBox_LangX1P1FileLocation, 1, wxEXPAND);
    Layout->Add(Path_LangX1P1FileLocation, 1, wxEXPAND);
    Layout->Add(CheckBox_LangWrite, 1, wxEXPAND);
    Layout->Add(CheckBox_LangWriteToLatest, 1, wxEXPAND);
    Layout->AddSpacer(15);
    Layout->AddSpacer(15);
    Layout->Add(CheckBox_DRSPath, 1, wxEXPAND);
    Layout->Add(Path_DRS, 1, wxEXPAND);
    Layout->Add(CheckBox_DRSPath2, 1, wxEXPAND);
    Layout->Add(Path_DRS2, 1, wxEXPAND);
    Layout->Add(CheckBox_DRSPath3, 1, wxEXPAND);
    Layout->Add(Path_DRS3, 1, wxEXPAND);
    Layout->Add(CheckBox_SlpPath, 1, wxEXPAND);
    Layout->Add(Path_SLP, 1, wxEXPAND);
    Layout->AddSpacer(15);
    Layout->AddSpacer(15);

    Layout->AddGrowableCol(1, 1);
    Layout->AddGrowableRow(17, 1);

    Main->Add(Defaults, 0, wxALIGN_LEFT | wxTOP | wxLEFT | wxRIGHT, 5);
    Main->Add(Defaults_StarWars, 0, wxALIGN_LEFT | wxBOTTOM | wxLEFT | wxRIGHT, 5);
    Main->Add(Layout, 1, wxEXPAND | wxALL, 5);
    Main->Add(Buttons, 0, wxALIGN_RIGHT | wxALL, 5);

    TerrainsBox->Enable(false);
    SetSizerAndFit(Main);
    SetDefaultItem(ButtonOK);

    Button_RawDecompress->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this](wxCommandEvent&)
    {
        genie::DatFile *raw;
        wxString filename = Path_RawDecompress->GetPath();
        wxString savename = filename+"u";
        if(!filename.empty())
        {
            raw = new genie::DatFile();
            raw->extractRaw(filename.c_str(), savename.c_str());
            delete raw;
        }
    });
}
Example #15
0
MadSaveQueryDialog::MadSaveQueryDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	//(*Initialize(MadSaveQueryDialog)
	wxBoxSizer* BoxSizer2;
	wxBoxSizer* BoxSizer1;
	wxBoxSizer* BoxSizer3;

	Create(parent, id, _("Save Modified Files"), wxDefaultPosition, wxDefaultSize, wxSTAY_ON_TOP|wxCAPTION|wxCLOSE_BOX|wxSIMPLE_BORDER, _T("id"));
	SetClientSize(wxDefaultSize);
	Move(wxDefaultPosition);
	BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
	BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
	MadFileList = new wxCheckedListCtrl(this, ID_LISTCTRLMADFILELIST, wxDefaultPosition, wxSize(400,300), wxLC_REPORT | wxSIMPLE_BORDER | wxVSCROLL, wxDefaultValidator, _T("ID_LISTCTRLMADFILELIST"));
	BoxSizer2->Add(MadFileList, 0, wxALL|wxEXPAND, 5);
	BoxSizer1->Add(BoxSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer3 = new wxBoxSizer(wxVERTICAL);
	ButtonOK = new wxButton(this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_OK"));
	ButtonOK->SetDefault();
	BoxSizer3->Add(ButtonOK, 0, wxALL|wxEXPAND, 2);
	ButtonSaveNone = new wxButton(this, ID_BUTTONSAVENONE, _("Save &None"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTONSAVENONE"));
	BoxSizer3->Add(ButtonSaveNone, 0, wxALL|wxEXPAND, 2);
	ButtonCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_CANCEL"));
	BoxSizer3->Add(ButtonCancel, 0, wxALL|wxEXPAND, 2);
	CheckBoxConfirm = new wxCheckBox(this, ID_CHECKBOXCONFIRM, _("Confirm"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOXCONFIRM"));
	CheckBoxConfirm->SetValue(false);
	BoxSizer3->Add(CheckBoxConfirm, 0, wxALL|wxEXPAND, 2);
	BoxSizer3->Add(-1,-1,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
	ButtonSelectAll = new wxButton(this, ID_BUTTONSELECTALL, _("Select &All"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTONSELECTALL"));
	BoxSizer3->Add(ButtonSelectAll, 0, wxALL|wxEXPAND, 2);
	ButtonDselectAll = new wxButton(this, ID_BUTTONDSELECTALL, _("Dselect &All"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTONDSELECTALL"));
	BoxSizer3->Add(ButtonDselectAll, 0, wxALL|wxEXPAND, 2);
	BoxSizer3->Add(-1,-1,0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
	ButtonGoTo = new wxButton(this, ID_BUTTONGOTO, _("&Go To"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTONGOTO"));
	BoxSizer3->Add(ButtonGoTo, 0, wxALL|wxEXPAND, 2);
	BoxSizer1->Add(BoxSizer3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);
	Center();

	Bind( wxEVT_COMMAND_LIST_ITEM_SELECTED, &MadSaveQueryDialog::OnMadFileListItemSelectChange, this, ID_LISTCTRLMADFILELIST );
	Bind( wxEVT_COMMAND_LIST_ITEM_DESELECTED, &MadSaveQueryDialog::OnMadFileListItemSelectChange, this, ID_LISTCTRLMADFILELIST );
	Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadSaveQueryDialog::OnButtonOKClick, this, wxID_OK );
	Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadSaveQueryDialog::OnButtonSaveNoneClick, this, ID_BUTTONSAVENONE );
	Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadSaveQueryDialog::OnButtonCancelClick, this, wxID_CANCEL );
	Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadSaveQueryDialog::OnButtonSelectAllClick, this, ID_BUTTONSELECTALL );
	Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadSaveQueryDialog::OnButtonDselectAllClick, this, ID_BUTTONDSELECTALL );
	Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadSaveQueryDialog::OnButtonGoToClick, this, ID_BUTTONGOTO );
	//*)

	SetDefaultItem(ButtonOK);
	m_MainFrame = static_cast<MadEditFrame *>(parent);
	wxListItem itemCol;
	itemCol.SetText(_("Name"));
	itemCol.SetAlign(wxLIST_FORMAT_LEFT);
	MadFileList->InsertColumn(0, itemCol);
	itemCol.SetText(_("Path"));
	itemCol.SetAlign(wxLIST_FORMAT_LEFT);
	MadFileList->InsertColumn(1, itemCol);
	InitWindowListIterms();
}
Example #16
0
PassUpdateFrame::PassUpdateFrame(wxWindow* parent, Logon& logon) 
    : wxDialog(parent, -1, "New Password", wxDefaultPosition, wxSize(260, 260), wxDIALOG_MODAL | wxDEFAULT_DIALOG_STYLE ), 
	m_logon(logon), 
    m_loginCtrl(NULL), m_passCtrl(NULL), m_newPassCtrl(NULL),  m_confirmCtrl(NULL), 
	m_button_OK(NULL)
 	  
{

    wxString loginText = wxString("Login:"******"Password:"******"New password:"******"Confirm new password:"******"Update", wxPoint( 50, 5));
//    m_button_OK->Enable(false);
    m_button_OK->SetDefault();
    SetDefaultItem(m_button_OK);

    m_button_CANCEL = new wxButton(p, Button_Cancel, "Cancel", wxPoint( 135, 5));

    wxStaticText* text1 = new wxStaticText( panel, -1, loginText, 
                                            wxPoint(textOffset, topOffset) );
    wxStaticText* text2 = new wxStaticText( panel, -1, passText, 
                                            wxPoint(textOffset, topOffset+rowOffset) );
    wxStaticText* text3 = new wxStaticText( panel, -1, newPassText, 
                                            wxPoint(textOffset, topOffset+(rowOffset*2)) );
    wxStaticText* text4 = new wxStaticText( panel, -1, confirmText, 
                                            wxPoint(textOffset, topOffset+(rowOffset*3)) );
    m_loginCtrl = new wxTextCtrl( panel, Username_Editor, GetLogon().GetLogin(),
                                            wxPoint(ctrlOffset, topOffset), 
                                            wxSize(ctrlWidth, -1) );
    m_passCtrl = new wxTextCtrl( panel, Password_Editor, "",
                                            wxPoint(ctrlOffset, topOffset+rowOffset), 
                                            wxSize(ctrlWidth, -1), wxTE_PASSWORD );
    m_newPassCtrl = new wxTextCtrl( panel, NewPassword_Editor, "",
                                            wxPoint(ctrlOffset, topOffset+(rowOffset*2)), 
                                            wxSize(ctrlWidth, -1), wxTE_PASSWORD );
    m_confirmCtrl = new wxTextCtrl( panel, Confirm_Editor, "",
                                            wxPoint(ctrlOffset, topOffset+(rowOffset*3)), 
                                            wxSize(ctrlWidth, -1), wxTE_PASSWORD );


    wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
    
    
    topSizer->Add( panel, 0, wxALIGN_TOP , 5 );
    topSizer->Add( p, 1, wxEXPAND, 5 );

    SetSizer( topSizer );

    topSizer->Fit( this );
    topSizer->SetSizeHints( this );
    topSizer->Layout();
    topSizer->RecalcSizes();

    m_loginCtrl->SetValue(GetLogon().GetLogin());
    m_passCtrl->SetValue(wxEmptyString);
}