BOOL CCpDialog::OnInitDialog() { CString strAppRootFolder = GetHomeFolder() + String(GetFolderId()); CString strContentRootFolder; CRegKey regkey; if (regkey.Open(HKEY_CURRENT_USER, REGKEY_APP) == ERROR_SUCCESS) { ULONG nLen = 255; char* pszValue = new char[nLen+1]; *pszValue = 0; nLen = 256; if (regkey.QueryStringValue(REGVAL_CONTENT_FOLDER, pszValue, &nLen) == ERROR_SUCCESS) { pszValue[nLen] = 0; strContentRootFolder = CString(pszValue); } delete [] pszValue; } if (strContentRootFolder.IsEmpty()) strContentRootFolder = GetHomeFolder() + String(IDS_CONTENT_FOLDER); DWORD dwCount = CheckForUiUpdates(strAppRootFolder); CheckForNewContent(strContentRootFolder, strAppRootFolder, (dwCount > 0)/*bForceCreate*/); // Update the variables.xsl and linelist.xml files SaveAppVariablesFile(strContentRootFolder, strAppRootFolder); SaveContentVariablesFile(strContentRootFolder, strAppRootFolder); CString strCaption; strCaption.LoadString(GetTitleId()); SetWindowText(strCaption); // Initialize the url prior to calling CDHtmlDialog::OnInitDialog() if (m_strCurrentUrl.IsEmpty()) m_strCurrentUrl = "about:blank"; CDHtmlDialog::OnInitDialog(); // This magically makes the scroll bars appear and dis-allows text selection DWORD dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_DIALOG; // DOCHOSTUIFLAG_NO3DOUTERBORDER; SetHostFlags(dwFlags); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(false); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icons for this dialog SetIcon(m_hIcon, true); // Set big icon SetIcon(m_hIcon, false); // Set small icon // Set the window size and position CRect rect; rect.SetRect(0, 0, 800, 600); if (0) // Restore the saved window size and position { DWORD dwSize = sizeof(rect); regkey.QueryBinaryValue(REGVAL_LOCATION, &rect, &dwSize); //j Someday, clip the rect to the display SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE); } else { SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE); CenterWindow(); } CString strHomePage = strAppRootFolder + String(IDS_HOME_PAGE); if (FileExists(strHomePage)) Navigate(strHomePage); ShowWindow(SW_NORMAL); DragAcceptFiles(false); return true; // return TRUE unless you set the focus to a control }
BOOL CSystemTray::SetIcon(LPCTSTR lpszIconName) { HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName); return SetIcon(hIcon); }
BOOL CTrayNotifyIcon::SetStandardIcon(LPCTSTR lpIconName) { HICON hIcon = ::LoadIcon(NULL, lpIconName); return SetIcon(hIcon); }
BOOL CMainWizard::OnInitDialog(void) { CString strRestore; CString strMinimize; CMenu menuTemp; CString strNewItem; int nInitialDelay, nAutoPopDelay; int cxMaxWidth; DWORD crTipBk, crTipText; // invoke inherited handler BOOL fResult = __super::OnInitDialog(); CenterWindow(FromHandle(::GetDesktopWindow())); // set wizard's icons SetIcon(m_hIcon, TRUE); SetIcon(m_hSmIcon, FALSE); // try to obtain localized text for the "Minimize" system command HMODULE hUser32 = ::GetModuleHandle(_T("user32")); if (menuTemp.Attach(::LoadMenu(hUser32, MAKEINTRESOURCE(16)))) { menuTemp.GetMenuString(SC_RESTORE, strRestore, MF_BYCOMMAND); menuTemp.GetMenuString(SC_MINIMIZE, strMinimize, MF_BYCOMMAND); ::DestroyMenu(menuTemp.Detach()); } if (strMinimize.IsEmpty()) { // probably f****n' Win9x strRestore.LoadString(IDS_SC_RESTORE); strMinimize.LoadString(IDS_SC_MINIMIZE); } // adjust system menu CMenu* pSysMenu = GetSystemMenu(FALSE); ASSERT_VALID(pSysMenu); pSysMenu->InsertMenu(SC_MOVE, MF_BYCOMMAND, SC_RESTORE, strRestore); pSysMenu->InsertMenu(SC_CLOSE, MF_BYCOMMAND, SC_MINIMIZE, strMinimize); pSysMenu->InsertMenu(SC_CLOSE, MF_BYCOMMAND | MF_SEPARATOR); MENUITEMINFO miInfo = { sizeof(miInfo), MIIM_BITMAP }; miInfo.hbmpItem = HBMMENU_POPUP_RESTORE; ::SetMenuItemInfo(pSysMenu->GetSafeHmenu(), SC_RESTORE, FALSE, &miInfo); miInfo.hbmpItem = HBMMENU_POPUP_MINIMIZE; ::SetMenuItemInfo(pSysMenu->GetSafeHmenu(), SC_MINIMIZE, FALSE, &miInfo); ModifyStyle(0, WS_MINIMIZEBOX); int iInsertPos = 0; CUpdateItApp* pApp = DYNAMIC_DOWNCAST(CUpdateItApp, AfxGetApp()); ASSERT_VALID(pApp); if (m_arrLangNames.GetCount() > 1) { CMenu menuLangs; menuLangs.LoadMenu(IDR_MENU_LANGS); CMenu* pPopupMenu = menuLangs.GetSubMenu(0); ASSERT_VALID(pPopupMenu); UINT_PTR uID = reinterpret_cast<UINT_PTR>(pPopupMenu->Detach()); CString strText; menuLangs.GetMenuString(0, strText, MF_BYPOSITION); pSysMenu->InsertMenu(iInsertPos++, MF_BYPOSITION | MF_POPUP, uID, strText); pSysMenu->InsertMenu(iInsertPos++, MF_BYPOSITION | MF_SEPARATOR); menuLangs.Detach(); CheckCurLangMenuItem(); } OSVERSIONINFO osVerInfo = { sizeof(osVerInfo) }; GetVersionEx(&osVerInfo); if (osVerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && osVerInfo.dwMajorVersion >= 5) { // Windows 2000/XP/2003 strNewItem.LoadString(IDS_SC_EXPORT_SETTINGS); pSysMenu->InsertMenu(iInsertPos++, MF_BYPOSITION, IDM_SC_EXPORT_SETTINGS, strNewItem); strNewItem.LoadString(IDS_SC_IMPORT_SETTINGS); pSysMenu->InsertMenu(iInsertPos++, MF_BYPOSITION, IDM_SC_IMPORT_SETTINGS, strNewItem); pSysMenu->InsertMenu(iInsertPos++, MF_BYPOSITION | MF_SEPARATOR); } // customize tool tips nInitialDelay = pApp->GetProfileInt(SZ_REGK_TIPS, SZ_REGV_TIPS_INITIAL_DELAY, 900); nAutoPopDelay = pApp->GetProfileInt(SZ_REGK_TIPS, SZ_REGV_TIPS_AUTO_POP_DELAY, 5000); cxMaxWidth = pApp->GetProfileInt(SZ_REGK_TIPS, SZ_REGV_TIPS_MAX_WIDTH, 300); crTipBk = pApp->GetProfileInt(SZ_REGK_TIPS, SZ_REGV_TIPS_BK_COLOR, ::GetSysColor(COLOR_INFOBK)); crTipText = pApp->GetProfileInt(SZ_REGK_TIPS, SZ_REGV_TIPS_TEXT_COLOR, ::GetSysColor(COLOR_INFOTEXT)); int cPages = m_pages.GetSize(); for (int i = 0; i < cPages; ++i) { CBetterPropPage* pPage = reinterpret_cast<CBetterPropPage*>(m_pages[i]); CToolTipCtrl& tipWnd = pPage->GetToolTipCtrl(); tipWnd.SetDelayTime(TTDT_INITIAL, nInitialDelay); tipWnd.SetDelayTime(TTDT_AUTOPOP, nAutoPopDelay); tipWnd.SetMaxTipWidth(cxMaxWidth); tipWnd.SetTipBkColor(crTipBk); tipWnd.SetTipTextColor(crTipText); } // initialized return (fResult); }
BOOL CTrayNotifyIcon::SetIcon(LPCTSTR lpIconName) { HICON hIcon = LoadIconResource(lpIconName); return SetIcon(hIcon); }
MainUiFrame::MainUiFrame(wxLocale &lang) : wxFrame(NULL, -1, _("Interface ")+APPLICATION_NAME, wxDefaultPosition, FromDIP(wxSize(1024,768)), wxDEFAULT_FRAME_STYLE),m_locale(lang) { saveManagerConfig=true; CustomLog logClass; // Liaison du manager aui à la fenêtre //m_mgr.SetFrame(this); m_mgr.SetManagedWindow(this); wxIcon ico_ui; if(ico_ui.LoadFile("./isimpa.ico",wxBITMAP_TYPE_ICO)) SetIcon(ico_ui); else wxLogError(_("Can not read the I-SIMPA icon")); //Creation des menus wxMenuBar* mb = new wxMenuBar; wxMenu* file_menu = new wxMenu; file_menu->Append(ID_nouveau_projet, _("New project\tCtrl+N")); file_menu->Append(ID_ouvrir, _("Open project\tCtrl+O")); file_menu->AppendSeparator(); file_menu->Append(ID_importer, _(wxT("Import new scene"))); file_menu->Append(ID_exporter, _("Export scene")); file_menu->Append(ID_generer, _("New scene")); file_menu->AppendSeparator(); file_menu->Append(ID_enregistrer, _("Save project\tCtrl+S")); file_menu->Append(ID_enregistrer_sous, _("Save project as...")); file_menu->Append(ID_enregistrer_copie, _("Save copy of project")); file_menu->AppendSeparator(); wxMenu* recent_projet_menu = new wxMenu; file_menu->Append(ID_projets_recent, _("Recent projects"),recent_projet_menu); //Utilisation de la classe projets récent fileHistory = new wxFileHistory(MAX_HISTORY_SHOW,ID_History); fileHistory->UseMenu(recent_projet_menu); fileHistory->Load(*ApplicationConfiguration::GetFileConfig()); file_menu->AppendSeparator(); wxMenu* file_preferences_menu = new wxMenu; file_preferences_menu->Append(ID_preferences_options, _("Options")); file_preferences_menu->Append(ID_preferences_lang, _("Language")); file_preferences_menu->Append(ID_preferences_appdata, _("Change application data folder")); file_menu->Append(ID_preferences, _("Settings"),file_preferences_menu); file_menu->AppendSeparator(); file_menu->Append(ID_fermer, _("Exit")); edit_menu = new wxMenu; edit_menu->Append(ID_annuler, _("Undo\tCtrl+Z"))->Enable(false); edit_menu->Append(ID_retablir, _("Redo\tCtrl+Y"))->Enable(false); wxMenu* simulation_menu = new wxMenu; simulation_menu->Append(ID_start_simulation, _("Play")); simulation_menu->Append(ID_pause_simulation, _("Pause")); simulation_menu->Append(ID_stop_simulation, _("Stop")); simulation_menu->AppendSeparator(); simulation_menu->Append(ID_Mailler, _("Meshing")); wxMenu* outils_menu = new wxMenu; wxMenu* outils_menu_postprocess = new wxMenu; outils_menu_postprocess->Append(ID_outil_resultpostprocess_substract_recepteursurf, _("Compare surface receivers")); outils_menu->Append(ID_outil_resultpostprocess,_("File results process"),outils_menu_postprocess); //outils_menu->AppendSeparator(); //outils_menu->Append(ID_outil_options, _("Options...")); view_menu = new wxMenu; view_face_menu = new wxMenu; view_face_menu->Append(ID_flat, _("Outside"),"Outside",wxITEM_RADIO); view_face_menu->Append(ID_flat_inside, _("Inside"),"Inside",wxITEM_RADIO); view_face_menu->Append(ID_flat_none, _("None"),"None",wxITEM_RADIO); view_face_menu->Check(ID_flat_inside,true); view_menu->Append(ID_fold_face, _("Faces"),view_face_menu); wxMenu* affichage_material_menu = new wxMenu; affichage_material_menu->Append(ID_ModelMaterial, _("Original"),"Original",wxITEM_RADIO); affichage_material_menu->Append(ID_SoundMaterial, _("Material"),"Material",wxITEM_RADIO); view_menu->Append(ID_fold_material, _("Material color"),affichage_material_menu); affichage_material_menu->Check(ID_ModelMaterial,true); view_line_menu = new wxMenu; view_line_menu->Append(ID_wireframe_all, _("All"),"All",wxITEM_RADIO); view_line_menu->Append(ID_wireframe_shape, _("Contour"),"Contour",wxITEM_RADIO); view_line_menu->Append(ID_wireframe_none, _("None"),"None",wxITEM_RADIO); view_line_menu->Check(ID_wireframe_none,true); view_menu->Append(ID_fold_wireframe, _("Lines"),view_line_menu); view_menu->AppendSeparator(); view_menu->Append(ID_ShowHideMailler, _("Hide meshing"),"Hide meshing",wxITEM_CHECK); view_menu->AppendSeparator(); view_menu->Append(ID_InitCamera, _("Reinitialize camera")); view_camera_menu = new wxMenu; view_camera_menu->Append(ID_camera_firstperson, _("First person"),"First person",wxITEM_RADIO); view_camera_menu->Append(ID_camera_rotate, _("Rotation / Zoom"),"Rotation / Zoom",wxITEM_RADIO); view_camera_menu->Check(ID_camera_rotate,true); view_menu->Append(ID_fold_camera, _("Camera"),view_camera_menu); view_menu->AppendSeparator(); //Ces éléments du menu interagissent avec l'etat d'élément du projet LinkMenuItemWithElement(view_menu->Append(ID_grid_xy, _("XY Grid"),"XY Grid",wxITEM_CHECK), Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_ORIGINE, "showgxy"); LinkMenuItemWithElement(view_menu->Append(ID_grid_xz, _("XZ Grid"),"XZ Grid",wxITEM_CHECK), Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_ORIGINE, "showgxz"); LinkMenuItemWithElement(view_menu->Append(ID_grid_yz, _("YZ Grid"),"YZ Grid",wxITEM_CHECK), Element::ELEMENT_TYPE_SCENE_PROJET_RENDU_ORIGINE, "showgyz"); view_menu->AppendSeparator(); // Copie de la fenêtre openGl dans un fichier ou dans le presse papier wxMenu* affichage_copygl = new wxMenu; //affichage_copygl->Append(ID_copygl_toclipboard, _("Vers le presse papier")); affichage_copygl->Append(ID_copygl_tofile, _("To file")); affichage_copygl->Append(ID_copygl_tofile_withdim, _("To a file with a specified resolution")); view_menu->Append(ID_fold_copygl, _("Copy 3D View"),affichage_copygl); //view_menu->AppendSeparator(); //view_menu->Append(ID_changeLanguage,_("Changer la langue du logiciel")); wxMenu* fenetre_menu = new wxMenu; fenetre_menu->Append(ID_clearwindowmanager, _("Reinitialize interface")); wxMenu* window3D_menu_console = new wxMenu; window3D_menu_console->Append(ID_Dock3Dwindow, _("Set 3D View as main window")); window3D_menu_console->Append(ID_Float3Dwindow, _("Floating 3D View")); fenetre_menu->AppendSubMenu(window3D_menu_console,_("3D View")); wxMenu* fenetre_menu_console = new wxMenu; fenetre_menu_console->Append(ID_Console_SaveToFile, _("Export to file")); fenetre_menu_console->AppendSeparator(); fenetre_menu_console->Append(ID_Console_ClearLog, _("Delete windows")); fenetre_menu->AppendSeparator(); fenetre_menu->AppendSubMenu(fenetre_menu_console,_("Console")); wxMenu* aide_menu = new wxMenu; //aide_menu->Append(ID_Help, _("Aide")); aide_menu->Append(ID_Help_Web, _("Website")); //aide_menu->Append(ID_Help_Forum, _("Online forums")); aide_menu->Append(ID_Help_Doc, _("Online documentation")); aide_menu->AppendSeparator(); aide_menu->Append(ID_Help_Doc_Isimpa_Pdf, _("I-Simpa documentation (PDF in French)")); aide_menu->Append(ID_Help_Doc_Spps_Pdf, _("SPPS documentation (PDF in French)")); aide_menu->AppendSeparator(); aide_menu->Append(ID_Help_About, _("About ")+APPLICATION_NAME); mb->Append(file_menu, _("File")); mb->Append(edit_menu, _("Edition")); mb->Append(simulation_menu, _("Simulation")); mb->Append(outils_menu, _("Tools")); mb->Append(view_menu, _("View")); mb->Append(fenetre_menu, _("Window")); mb->Append(aide_menu, _("Help")); SetMenuBar(mb); wxSize client_size = GetClientSize(); // Creation du contrôle texte d'historique des opérations shellNotebook= new wxAuiNotebook(this, wxID_ANY, wxPoint(client_size.x, client_size.y), FromDIP(wxSize(430,200)), wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS ); shellNotebook->SetName("console"); logWindow = new wxTextCtrl(this, -1, "", wxDefaultPosition, FromDIP(wxSize(200,150)), wxTE_RICH | wxNO_BORDER | wxTE_MULTILINE | wxTE_READONLY); shellNotebook->AddPage(logWindow, _("Messages") , true); #ifdef USE_PYTHON PyConsole* consolePython=new PyConsole(this); shellNotebook->AddPage(consolePython, _("Python(TM)") , false); #else PyConsole* consolePython=NULL; #endif //Creation du panneau qui contient 3 arbres ctrlNotebook = new wxAuiNotebook(this, wxID_ANY, wxPoint(client_size.x, client_size.y), FromDIP(wxSize(430,200)), wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS ); // Creation des 3 arbres de gestion du projet this->treeCore = new uiTreeCtrl(ctrlNotebook.get(), -1, wxPoint(0,0), FromDIP(wxSize(-1,250)),wxTR_EDIT_LABELS | wxNO_BORDER | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT, true); //wxTR_MULTIPLE | this->treeResult = new uiTreeCtrl(ctrlNotebook.get(), -1, wxPoint(0,0), FromDIP(wxSize(-1,250)), wxTR_EDIT_LABELS | wxNO_BORDER | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT, false ); this->treeScene = new uiTreeCtrl(ctrlNotebook.get(), -1, wxPoint(0,0), FromDIP(wxSize(-1,250)), wxTR_EDIT_LABELS | wxNO_BORDER | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT, true ); // this->treeUserPref = new uiTreeCtrl(this, -1, wxPoint(0,0), FromDIP(wxSize(-1,250)), wxTR_EDIT_LABELS | wxNO_BORDER | wxTR_MULTIPLE | wxTR_HAS_BUTTONS | wxTR_HIDE_ROOT, true ); // treeCore->BindElementEvent(&OnCoreElementEvent); treeResult->BindElementEvent(&OnReportElementEvent); treeScene->BindElementEvent(&OnSceneElementEvent); treeUserPref->BindElementEvent(&OnUserConfigElementEvent); ctrlNotebook->AddPage(this->treeScene, _("Scene") , false); ctrlNotebook->AddPage(this->treeCore, _("Calculation") , false); ctrlNotebook->AddPage(this->treeResult, _("Results") , false); // Ajout des panneaux de l'interface m_mgr.AddPane(ctrlNotebook.get(), wxAuiPaneInfo(). Name("projet").Caption(_("Project")). Left().Position(0).CloseButton(false)); m_mgr.AddPane(shellNotebook.get(), wxAuiPaneInfo(). Name("console").Caption(_("Console")). Bottom().Position(0).CloseButton(false)); m_mgr.AddPane(treeUserPref.get(), wxAuiPaneInfo(). Name("userpref").Caption(_("Interface options")).Hide() ); #ifdef __WXMSW__ int *gl_attrib = NULL; #else int gl_attrib[20] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1, WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1, WX_GL_DOUBLEBUFFER, # if defined(__WXMAC__) || defined(__WXQT__) GL_NONE }; # else None };
ReminderDialog::ReminderDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) : feedbackWritten(false) { //(*Initialize(ReminderDialog) wxFlexGridSizer* FlexGridSizer4; wxFlexGridSizer* FlexGridSizer5; wxFlexGridSizer* FlexGridSizer2; wxFlexGridSizer* FlexGridSizer7; wxFlexGridSizer* FlexGridSizer8; wxFlexGridSizer* FlexGridSizer6; wxFlexGridSizer* FlexGridSizer1; Create(parent, wxID_ANY, _("Support Game Develop"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer1->AddGrowableRow(2); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Thank you for using Game Develop!"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); wxFont StaticText1Font(13,wxDEFAULT,wxFONTSTYLE_NORMAL,wxNORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT); StaticText1->SetFont(StaticText1Font); FlexGridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer7 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer7->AddGrowableCol(0); StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("We\'d love to get your feedback about Game Develop! You can write us something\nabout the software:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4")); FlexGridSizer7->Add(StaticText4, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); feedbackEdit = new wxTextCtrl(this, ID_TEXTCTRL1, _("Write a short sentence about GD!"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); FlexGridSizer7->Add(feedbackEdit, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer8 = new wxFlexGridSizer(0, 3, 0, 0); FlexGridSizer8->AddGrowableCol(1); StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("Your mail address:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5")); FlexGridSizer8->Add(StaticText5, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); mailEdit = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); mailEdit->SetToolTip(_("No worries, it won\'t be shared with any 3rd parties! It\'s just useful for us if we want to discuss with you :D")); FlexGridSizer8->Add(mailEdit, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); sendBt = new wxButton(this, ID_BUTTON3, _("Send!"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); FlexGridSizer8->Add(sendBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer7->Add(FlexGridSizer8, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1")); FlexGridSizer7->Add(StaticLine1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(FlexGridSizer7, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer4 = new wxFlexGridSizer(0, 3, 0, 0); FlexGridSizer4->AddGrowableRow(0); imageBmp = new wxStaticBitmap(this, ID_STATICBITMAP1, wxBitmap(wxImage(_T("res/reminder-1.png"))), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, _T("ID_STATICBITMAP1")); imageBmp->SetToolTip(_("This image is chosen at random each time the window is shown!")); FlexGridSizer4->Add(imageBmp, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer5 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer5->AddGrowableCol(0); FlexGridSizer5->AddGrowableRow(0); FlexGridSizer6 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer6->AddGrowableRow(2); StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("A crowdfunding campaign was launched for Game Develop.\nHelp us bring GD to MacOS, improve the support of Ubuntu\nand create an export option to publish games to iOS and \nAndroid!\n\nContributors will get premium access to the beta versions\nwhen new features (OS X/Android/iOS support...)\nwill be released!"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3")); FlexGridSizer6->Add(StaticText3, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); HyperlinkCtrl2 = new wxHyperlinkCtrl(this, ID_HYPERLINKCTRL2, _("Contribute to the campaign on Indiegogo"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE|wxNO_BORDER, _T("ID_HYPERLINKCTRL2")); FlexGridSizer6->Add(HyperlinkCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer6->Add(0,0,1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer5->Add(FlexGridSizer6, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer2 = new wxFlexGridSizer(0, 3, 0, 0); neverBt = new wxButton(this, ID_BUTTON1, _("Never show again ;)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); FlexGridSizer2->Add(neverBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); laterBt = new wxButton(this, ID_BUTTON2, _("No thanks, maybe later! :)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); laterBt->SetToolTip(_("This window will be shown when you\'ll be launching GD for the third time in a row")); FlexGridSizer2->Add(laterBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer5->Add(FlexGridSizer2, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer4->Add(FlexGridSizer5, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer1->Add(FlexGridSizer4, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); SetSizer(FlexGridSizer1); FlexGridSizer1->Fit(this); FlexGridSizer1->SetSizeHints(this); Center(); Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&ReminderDialog::OnfeedbackEditText); Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ReminderDialog::OnsendBtClick); Connect(ID_HYPERLINKCTRL2,wxEVT_COMMAND_HYPERLINK,(wxObjectEventFunction)&ReminderDialog::OnHyperlinkCtrl2Click); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ReminderDialog::OnneverBtClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ReminderDialog::OnlaterBtClick); Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&ReminderDialog::OnClose); //*) wxIcon frameIcon; frameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("res/hearticon.png")))); SetIcon(frameIcon); srand(static_cast<unsigned int>(time(NULL))); imageId = gd::ToString(rand()%3 + 1); imageBmp->SetBitmap(wxBitmap(wxImage("res/reminder-"+imageId+".png"))); }
BOOL CSystemTray::SetIcon(UINT nIDResource) { return SetIcon(MAKEINTRESOURCE(nIDResource)); }
BOOL CSystemTray::SetStandardIcon(LPCTSTR lpIconName) { HICON hIcon = LoadIcon(NULL, lpIconName); return SetIcon(hIcon); }
BOOL CTryIconDriver::SetIcon(UINT nIDResource) { HICON hIcon = AfxGetApp()->LoadIcon(nIDResource); return SetIcon(hIcon); }
BOOL CTryIconDriver::SetIcon(LPCTSTR lpIconName) { HICON hIcon = AfxGetApp()->LoadIcon(lpIconName); return SetIcon(hIcon); }
// My frame constructor MyFrame::MyFrame(const wxChar *title) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)) { m_listCtrl = NULL; m_logWindow = NULL; m_smallVirtual = false; m_numListItems = 10; // Give it an icon SetIcon(wxICON(sample)); // Make an image list containing large icons m_imageListNormal = new wxImageList(32, 32, true); m_imageListSmall = new wxImageList(16, 16, true); #ifdef wxHAS_IMAGES_IN_RESOURCES m_imageListNormal->Add( wxIcon(wxT("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListNormal->Add( wxIcon(wxT("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) ); m_imageListSmall->Add( wxIcon(wxT("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) ); #else m_imageListNormal->Add( wxIcon( toolbrai_xpm ) ); m_imageListNormal->Add( wxIcon( toolchar_xpm ) ); m_imageListNormal->Add( wxIcon( tooldata_xpm ) ); m_imageListNormal->Add( wxIcon( toolnote_xpm ) ); m_imageListNormal->Add( wxIcon( tooltodo_xpm ) ); m_imageListNormal->Add( wxIcon( toolchec_xpm ) ); m_imageListNormal->Add( wxIcon( toolgame_xpm ) ); m_imageListNormal->Add( wxIcon( tooltime_xpm ) ); m_imageListNormal->Add( wxIcon( toolword_xpm ) ); m_imageListSmall->Add( wxIcon( small1_xpm) ); #endif // Make a menubar wxMenu *menuFile = new wxMenu; menuFile->Append(LIST_ABOUT, wxT("&About")); menuFile->AppendSeparator(); menuFile->Append(LIST_QUIT, wxT("E&xit\tAlt-X")); wxMenu *menuView = new wxMenu; menuView->Append(LIST_LIST_VIEW, wxT("&List view\tF1")); menuView->Append(LIST_REPORT_VIEW, wxT("&Report view\tF2")); menuView->Append(LIST_ICON_VIEW, wxT("&Icon view\tF3")); menuView->Append(LIST_ICON_TEXT_VIEW, wxT("Icon view with &text\tF4")); menuView->Append(LIST_SMALL_ICON_VIEW, wxT("&Small icon view\tF5")); menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, wxT("Small icon &view with text\tF6")); menuView->Append(LIST_VIRTUAL_VIEW, wxT("&Virtual view\tF7")); menuView->Append(LIST_SMALL_VIRTUAL_VIEW, wxT("Small virtual vie&w\tF8")); menuView->AppendSeparator(); menuView->Append(LIST_SET_ITEMS_COUNT, "Set &number of items"); #ifdef __WXOSX__ menuView->AppendSeparator(); menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, wxT("Mac: Use Generic Control")); #endif wxMenu *menuList = new wxMenu; menuList->Append(LIST_GOTO, wxT("&Go to item #3\tCtrl-3")); menuList->Append(LIST_FOCUS_LAST, wxT("&Make last item current\tCtrl-L")); menuList->Append(LIST_TOGGLE_FIRST, wxT("To&ggle first item\tCtrl-G")); menuList->Append(LIST_DESELECT_ALL, wxT("&Deselect All\tCtrl-D")); menuList->Append(LIST_SELECT_ALL, wxT("S&elect All\tCtrl-A")); menuList->AppendSeparator(); menuList->Append(LIST_SHOW_COL_INFO, wxT("Show &column info\tCtrl-C")); menuList->Append(LIST_SHOW_SEL_INFO, wxT("Show &selected items\tCtrl-S")); menuList->Append(LIST_SHOW_VIEW_RECT, wxT("Show &view rect")); #ifdef wxHAS_LISTCTRL_COLUMN_ORDER menuList->Append(LIST_SET_COL_ORDER, wxT("Se&t columns order\tShift-Ctrl-O")); menuList->Append(LIST_GET_COL_ORDER, wxT("Sho&w columns order\tCtrl-O")); #endif // wxHAS_LISTCTRL_COLUMN_ORDER menuList->AppendSeparator(); menuList->Append(LIST_SORT, wxT("Sor&t\tCtrl-T")); menuList->Append(LIST_FIND, "Test Find() performance"); menuList->AppendSeparator(); menuList->Append(LIST_ADD, wxT("&Append an item\tCtrl-P")); menuList->Append(LIST_EDIT, wxT("&Edit the item\tCtrl-E")); menuList->Append(LIST_DELETE, wxT("&Delete first item\tCtrl-X")); menuList->Append(LIST_DELETE_ALL, wxT("Delete &all items")); menuList->AppendSeparator(); menuList->Append(LIST_FREEZE, wxT("Free&ze\tCtrl-Z")); menuList->Append(LIST_THAW, wxT("Tha&w\tCtrl-W")); menuList->AppendSeparator(); menuList->AppendCheckItem(LIST_TOGGLE_LINES, wxT("Toggle &lines\tCtrl-I")); menuList->AppendCheckItem(LIST_TOGGLE_MULTI_SEL, wxT("&Multiple selection\tCtrl-M")); menuList->Check(LIST_TOGGLE_MULTI_SEL, true); menuList->AppendCheckItem(LIST_TOGGLE_HEADER, "Toggle &header\tCtrl-H"); menuList->Check(LIST_TOGGLE_HEADER, true); menuList->AppendCheckItem(LIST_TOGGLE_BELL, "Toggle &bell on no match"); menuList->AppendSeparator(); menuList->AppendCheckItem(LIST_TOGGLE_CHECKBOXES, wxT("&Enable Checkboxes")); menuList->Check(LIST_TOGGLE_CHECKBOXES, true); menuList->Append(LIST_TOGGLE_CHECKBOX, wxT("Toggle the item checkbox state")); menuList->Append(LIST_GET_CHECKBOX, wxT("Get the item checkbox state")); wxMenu *menuCol = new wxMenu; menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour...")); menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour...")); menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours")); wxMenuBar *menubar = new wxMenuBar; menubar->Append(menuFile, wxT("&File")); menubar->Append(menuView, wxT("&View")); menubar->Append(menuList, wxT("&List")); menubar->Append(menuCol, wxT("&Colour")); SetMenuBar(menubar); m_panel = new wxPanel(this, wxID_ANY); m_logWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE | wxSUNKEN_BORDER); m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow)); RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL); #ifdef __WXMSW__ // this is useful to know specially when debugging :) wxLogMessage("Your version of comctl32.dll is: %d", wxApp::GetComCtl32Version()); #endif #if wxUSE_STATUSBAR CreateStatusBar(); #endif // wxUSE_STATUSBAR }
BOOL CSystemTray::SetStandardIcon(UINT nIDResource) { HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(nIDResource)); return SetIcon(hIcon); }
BOOL CSystemTray::SetIcon(UINT nIDResource) { HICON hIcon = AfxGetApp()->LoadIcon(nIDResource); return SetIcon(hIcon); }
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size ) : EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size, KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME ) { m_active_project = false; m_leftWinWidth = 60; m_manager_Hokeys_Descr = NULL; // Create the status line (bottom of the frame static const int dims[3] = { -1, -1, 100 }; CreateStatusBar( 3 ); SetStatusWidths( 3, dims ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_kicad_xpm ) ); SetIcon( icon ); // Give the last sise and pos to main window LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Left window: is the box which display tree project m_LeftWin = new TREE_PROJECT_FRAME( this ); // Right top Window: buttons to launch applications m_Launcher = new LAUNCHER_PANEL( this ); // Add the wxTextCtrl showing all messages from KiCad: m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY ); RecreateBaseHToolbar(); ReCreateMenuBar(); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiztb; horiztb.HorizontalToolbarPane(); EDA_PANEINFO info; info.InfoToolbarPane(); m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() ); m_auimgr.AddPane( m_LeftWin, wxAuiPaneInfo(info).Name( wxT( "m_LeftWin" ) ).Left(). BestSize( m_leftWinWidth, -1 ). Layer( 1 ) ); m_auimgr.AddPane( m_Launcher, wxTOP ); m_auimgr.GetPane( m_Launcher).CaptionVisible( false ).Row(1) .BestSize( -1, m_Launcher->GetPanelHeight() ).PaneBorder( false ).Resizable( false ); m_auimgr.AddPane( m_MessagesBox, wxAuiPaneInfo().Name( wxT( "m_MessagesBox" ) ).CentrePane().Layer( 2 ) ); m_auimgr.GetPane( m_LeftWin ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_LeftWin ).BestSize(wxSize(m_leftWinWidth, -1) ); m_auimgr.Update(); }
BOOL CSignalGeneratorDlg::OnInitDialog() { bool success = false; CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // Initialize the DeckLink API IDeckLinkIterator* deckLinkIterator = NULL; HRESULT result; CoInitializeEx(NULL, COINIT_MULTITHREADED); result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&deckLinkIterator); if (FAILED(result)) { MessageBox(_T("This application requires the DeckLink drivers installed.\nPlease install the Blackmagic DeckLink drivers to use the features of this application."), _T("Error")); goto bail; } // Connect to the first DeckLink instance result = deckLinkIterator->Next(&m_deckLink); if (result != S_OK) { MessageBox(_T("This application requires a DeckLink PCI card.\nYou will not be able to use the features of this application until a DeckLink PCI card is installed."), _T("Error")); goto bail; } // Obtain the audio/video output interface (IDeckLinkOutput) if (m_deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&m_deckLinkOutput) != S_OK) goto bail; // Provide this class as a delegate to the audio and video output interfaces m_deckLinkOutput->SetScheduledFrameCompletionCallback(this); m_deckLinkOutput->SetAudioCallback(this); // Set the item data for combo box entries to store audio channel count and sample depth information m_outputSignalCombo.SetItemData(0, kOutputSignalPip); m_outputSignalCombo.SetItemData(1, kOutputSignalDrop); // m_audioChannelCombo.SetItemData(0, 2); // 2 channels m_audioChannelCombo.SetItemData(1, 8); // 8 channels m_audioChannelCombo.SetItemData(2, 16); // 16 channels // m_audioSampleDepthCombo.SetItemData(0, 16); // 16-bit samples m_audioSampleDepthCombo.SetItemData(1, 32); // 32-bit samples m_pixelFormatCombo.SetItemData(0, bmdFormat8BitYUV); m_pixelFormatCombo.SetItemData(1, bmdFormat10BitYUV); m_pixelFormatCombo.SetItemData(2, bmdFormat8BitARGB); m_pixelFormatCombo.SetItemData(3, bmdFormat10BitRGB); // Select the first item in each combo box m_outputSignalCombo.SetCurSel(0); m_audioChannelCombo.SetCurSel(0); m_audioSampleDepthCombo.SetCurSel(0); m_pixelFormatCombo.SetCurSel(0); RefreshDisplayModeMenu(); success = true; bail: if (success == false) { // Release any resources that were partially allocated if (m_deckLinkOutput != NULL) { m_deckLinkOutput->Release(); m_deckLinkOutput = NULL; } // if (m_deckLink != NULL) { m_deckLink->Release(); m_deckLink = NULL; } // Disable the user interface if we could not succsssfully connect to a DeckLink device m_startButton.EnableWindow(FALSE); EnableInterface(FALSE); } if (deckLinkIterator != NULL) deckLinkIterator->Release(); return TRUE; // return TRUE unless you set the focus to a control }
int Display::OnInitDialog() { CFont myfont; isSave=FALSE; myfont.CreateFont(20,12,0,0,0,0,0,0,0,0,0,0,0,"System"); SetDlgItemText(IDC_EDIT1,"localhost"); SetDlgItemInt(IDC_EDIT2,1051); SetDlgItemText(IDC_EDIT3,"logname"); cbox=(CComboBox*)GetDlgItem(IDC_COMBO1); anicon=(CAnimateCtrl*)GetDlgItem(IDC_ANIMATE1); talk=(CAnimateCtrl*)GetDlgItem(IDC_ANIMATE2); if(!anicon->Open("conn.avi")) { success=FALSE; log.WriteString("\nUnable to open the avi file ****"); } else success=TRUE; if(!talk->Open("talk.avi")) { doit=FALSE; log.WriteString("\n Unable to open the talk.avi file"); } else doit=TRUE; // from=(CListBox *)GetDlgItem(IDC_LIST1); // from->SetFont(&myfont); curuser.Empty(); //Set the Icon for the application HICON m_hicon=AfxGetApp()->LoadIcon(IDI_ICON1); SetIcon(m_hicon,TRUE); SetIcon(m_hicon,FALSE); //Initializes socket if(!::AfxSocketInit()) { log.WriteString("\nSocket initialization failed"); return 0; } //Create Client socket object sockclt.setparent(this); sockclt.Create(); //Create and Start Recorder Thread record=new RecordSound(this); record->CreateThread(); //Create and Start Player Thread play=new PlaySound1(this); play->CreateThread(); //Create the Writer Thread to save the sound write=new WriteSound(); write->CreateThread(); selectflag=0; start=stop=NULL; radio3=(CButton*)GetDlgItem(IDC_RADIO_BLOCK); radio3->SetCheck(true); radio4=(CButton*)GetDlgItem(IDC_RADIO_STREAM); return CDialog::OnInitDialog(); }
// Define my frame constructor MyFrame::MyFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300)) { // Give it an icon SetIcon(wxICON(sample)); // Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q")); wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, wxT("&File")); // Associate the menu bar with the frame SetMenuBar(menu_bar); // set a dialog background SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); // add the controls to the frame wxString strs4[] = { IPC_SERVICE, wxT("...") }; wxString strs5[] = { IPC_HOST, wxT("...") }; wxString strs6[] = { IPC_TOPIC, wxT("...") }; wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL ); wxGridSizer *item2 = new wxGridSizer( 4, 0, 0 ); wxButton *item3 = new wxButton( this, ID_START, wxT("Connect to server"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxChoice *item5 = new wxChoice( this, ID_HOSTNAME, wxDefaultPosition, wxSize(100,-1), 2, strs5, 0 ); item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 ); wxChoice *item4 = new wxChoice( this, ID_SERVERNAME, wxDefaultPosition, wxSize(100,-1), 2, strs4, 0 ); item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxChoice *item6 = new wxChoice( this, ID_TOPIC, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 ); item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item7 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect "), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item8 = new wxButton( this, ID_STARTADVISE, wxT("StartAdvise"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item9 = new wxButton( this, ID_STOPADVISE, wxT("StopAdvise"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item10 = new wxButton( this, ID_EXECUTE, wxT("Execute"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item11 = new wxButton( this, ID_POKE, wxT("Poke"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item12 = new wxButton( this, ID_REQUEST, wxT("Request"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); item1->Add( item2, 1, wxALIGN_CENTER|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticBox *item14 = new wxStaticBox( this, -1, wxT("Client log") ); wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL ); wxTextCtrl *item15 = new wxTextCtrl( this, ID_LOG, wxEmptyString, wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE ); item13->Add( item15, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); this->SetSizer( item0 ); item0->SetSizeHints( this ); // status m_client = NULL; GetServername()->SetSelection(0); GetHostname()->SetSelection(0); GetTopic()->SetSelection(0); wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog()); delete wxLog::SetActiveTarget(logWindow); wxLogMessage(wxT("Click on Connect to connect to the server")); EnableControls(); }
SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SIM_PLOT_FRAME_BASE( aParent ), m_lastSimPlot( nullptr ) { SetKiway( this, aKiway ); m_signalsIconColorList = NULL; m_schematicFrame = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false ); if( m_schematicFrame == NULL ) throw std::runtime_error( "There is no schematic window" ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( simulator_xpm ) ); SetIcon( icon ); // Get the previous size and position of windows: LoadSettings( config() ); m_simulator = SPICE_SIMULATOR::CreateInstance( "ngspice" ); if( !m_simulator ) { throw std::runtime_error( "Could not create simulator instance" ); return; } m_simulator->Init(); if( m_savedWorkbooksPath.IsEmpty() ) { m_savedWorkbooksPath = Prj().GetProjectPath(); } m_reporter = new SIM_THREAD_REPORTER( this ); m_simulator->SetReporter( m_reporter ); updateNetlistExporter(); Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SIM_PLOT_FRAME::onClose ), NULL, this ); Connect( EVT_SIM_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onSimUpdate ), NULL, this ); Connect( EVT_SIM_REPORT, wxCommandEventHandler( SIM_PLOT_FRAME::onSimReport ), NULL, this ); Connect( EVT_SIM_STARTED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimStarted ), NULL, this ); Connect( EVT_SIM_FINISHED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimFinished ), NULL, this ); Connect( EVT_SIM_CURSOR_UPDATE, wxCommandEventHandler( SIM_PLOT_FRAME::onCursorUpdate ), NULL, this ); // Toolbar buttons m_toolSimulate = m_toolBar->AddTool( ID_SIM_RUN, _( "Run/Stop Simulation" ), KiBitmap( sim_run_xpm ), _( "Run Simulation" ), wxITEM_NORMAL ); m_toolAddSignals = m_toolBar->AddTool( ID_SIM_ADD_SIGNALS, _( "Add Signals" ), KiBitmap( sim_add_signal_xpm ), _( "Add signals to plot" ), wxITEM_NORMAL ); m_toolProbe = m_toolBar->AddTool( ID_SIM_PROBE, _( "Probe" ), KiBitmap( sim_probe_xpm ), _( "Probe signals on the schematic" ), wxITEM_NORMAL ); m_toolTune = m_toolBar->AddTool( ID_SIM_TUNE, _( "Tune" ), KiBitmap( sim_tune_xpm ), _( "Tune component values" ), wxITEM_NORMAL ); m_toolSettings = m_toolBar->AddTool( wxID_ANY, _( "Settings" ), KiBitmap( sim_settings_xpm ), _( "Simulation settings" ), wxITEM_NORMAL ); Connect( m_toolSimulate->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onSimulate ), NULL, this ); Connect( m_toolAddSignals->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onAddSignal ), NULL, this ); Connect( m_toolProbe->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onProbe ), NULL, this ); Connect( m_toolTune->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onTune ), NULL, this ); Connect( m_toolSettings->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SIM_PLOT_FRAME::onSettings ), NULL, this ); // Bind toolbar buttons event to existing menu event handlers, so they behave the same Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSimulate, this, m_runSimulation->GetId() ); Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onAddSignal, this, m_addSignals->GetId() ); Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onProbe, this, m_probeSignals->GetId() ); Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onTune, this, m_tuneValue->GetId() ); Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSettings, this, m_settings->GetId() ); m_toolBar->Realize(); m_plotNotebook->SetPageText( 0, _( "Welcome!" ) ); // the settings dialog will be created later, on demand. // if created in the ctor, for some obscure reason, there is an issue // on Windows: when open it, the simulator frame is sent to the background. // instead of being behind the dialog frame (as it does) m_settingsDlg = NULL; // resize the subwindows size. At least on Windows, calling wxSafeYield before // resizing the subwindows forces the wxSplitWindows size events automatically generated // by wxWidgets to be executed before our resize code. // Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these // events wxSafeYield(); setSubWindowsSashSize(); }
BOOL CMainDialog::OnInitDialog() { CDialog::OnInitDialog(); CreateSizeGrip(true); CreateToolTip(); // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); // Add "About..." menu item to system menu. CMenu *pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog. SetIcon(m_icon, TRUE); // Set big icon. SetIcon(m_icon, FALSE); // Set small icon. // Tell our Rich-Text field that it shall reflect its messages // to this dialog. I'm to lazy to make an extra subclass. m_example_text.SetEventMask(ENM_MOUSEEVENTS); m_example_text.SetWindowText(_T("Das ist ein schöner Test-Text.\n1234567890")); GetFontsList(); m_height = 50; m_weight = FW_NORMAL; m_facename = _T(""); m_combo_weight.SelectString(-1, _T("Normal")); m_combo_height.SelectString(-1, _T("50")); m_spin_weight.SetBuddy(&m_combo_weight); m_spin_height.SetBuddy(&m_combo_height); if (m_fonts_list.GetCount() > 0) { m_fonts_list.SetCurSel(0); // Select first font in list. OnLbnSelchangeFontsList(); } AddToolTips(); m_tooltip.AddTool(this, _T("TEST")); m_tooltip.AddTool(GetDlgItem(IDOK), _T("OKAY")); return TRUE; // Return TRUE, unless you set the focus to a control. }
DialogTimingProcessor::DialogTimingProcessor(agi::Context *c) : wxDialog(c->parent,-1,_("Timing Post-Processor"),wxDefaultPosition,wxSize(400,250),wxDEFAULT_DIALOG_STYLE) , c(c) { SetIcon(BitmapToIcon(GETIMAGE(timing_processor_toolbutton_24))); // Set variables wxString leadInTime(wxString::Format("%d", OPT_GET("Audio/Lead/IN")->GetInt())); wxString leadOutTime(wxString::Format("%d", OPT_GET("Audio/Lead/OUT")->GetInt())); wxString thresStartBefore(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key Start Before")->GetInt())); wxString thresStartAfter(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key Start After")->GetInt())); wxString thresEndBefore(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key End Before")->GetInt())); wxString thresEndAfter(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Key End After")->GetInt())); wxString adjsThresTime(wxString::Format("%d", OPT_GET("Tool/Timing Post Processor/Threshold/Adjacent")->GetInt())); // Styles box wxSizer *LeftSizer = new wxStaticBoxSizer(wxVERTICAL,this,_("Apply to styles")); wxArrayString styles = c->ass->GetStyles(); StyleList = new wxCheckListBox(this,TIMING_STYLE_LIST,wxDefaultPosition,wxSize(150,150),styles); StyleList->SetToolTip(_("Select styles to process. Unchecked ones will be ignored.")); wxButton *all = new wxButton(this,BUTTON_SELECT_ALL,_("All")); all->SetToolTip(_("Select all styles.")); wxButton *none = new wxButton(this,BUTTON_SELECT_NONE,_("None")); none->SetToolTip(_("Deselect all styles.")); // Options box wxSizer *optionsSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Options")); onlySelection = new wxCheckBox(this,-1,_("Affect selection only")); onlySelection->SetValue(OPT_GET("Tool/Timing Post Processor/Only Selection")->GetBool()); optionsSizer->Add(onlySelection,1,wxALL,0); // Lead-in/out box wxSizer *LeadSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Lead-in/Lead-out")); hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:")); hasLeadIn->SetToolTip(_("Enable adding of lead-ins to lines.")); hasLeadIn->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/IN")->GetBool()); leadIn = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadInTime)); leadIn->SetToolTip(_("Lead in to be added, in milliseconds.")); hasLeadOut = new wxCheckBox(this,CHECK_ENABLE_LEADOUT,_("Add lead out:")); hasLeadOut->SetToolTip(_("Enable adding of lead-outs to lines.")); hasLeadOut->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Lead/OUT")->GetBool()); leadOut = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(80,-1),0,NumValidator(leadOutTime)); leadOut->SetToolTip(_("Lead out to be added, in milliseconds.")); LeadSizer->Add(hasLeadIn,0,wxRIGHT|wxEXPAND,5); LeadSizer->Add(leadIn,0,wxRIGHT|wxEXPAND,5); LeadSizer->Add(hasLeadOut,0,wxRIGHT|wxEXPAND,5); LeadSizer->Add(leadOut,0,wxRIGHT|wxEXPAND,0); LeadSizer->AddStretchSpacer(1); // Adjacent subs sizer wxSizer *AdjacentSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Make adjacent subtitles continuous")); adjsEnable = new wxCheckBox(this,CHECK_ENABLE_ADJASCENT,_("Enable")); adjsEnable->SetToolTip(_("Enable snapping of subtitles together if they are within a certain distance of each other.")); adjsEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Adjacent")->GetBool()); wxStaticText *adjsThresText = new wxStaticText(this,-1,_("Threshold:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); adjacentThres = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(adjsThresTime)); adjacentThres->SetToolTip(_("Maximum difference between start and end time for two subtitles to be made continuous, in milliseconds.")); adjacentBias = new wxSlider(this,-1,mid(0,int(OPT_GET("Tool/Timing Post Processor/Adjacent Bias")->GetDouble()*100),100),0,100,wxDefaultPosition,wxSize(-1,20)); adjacentBias->SetToolTip(_("Sets how to set the adjoining of lines. If set totally to left, it will extend start time of the second line; if totally to right, it will extend the end time of the first line.")); AdjacentSizer->Add(adjsEnable,0,wxRIGHT|wxEXPAND,10); AdjacentSizer->Add(adjsThresText,0,wxRIGHT|wxALIGN_CENTER,5); AdjacentSizer->Add(adjacentThres,0,wxRIGHT|wxEXPAND,5); AdjacentSizer->Add(new wxStaticText(this,-1,_("Bias: Start <- "),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE),0,wxALIGN_CENTER,0); AdjacentSizer->Add(adjacentBias,1,wxEXPAND,0); AdjacentSizer->Add(new wxStaticText(this,-1,_(" -> End"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE),0,wxALIGN_CENTER,0); // Keyframes sizer KeyframesSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Keyframe snapping")); wxSizer *KeyframesFlexSizer = new wxFlexGridSizer(2,5,5,0); keysEnable = new wxCheckBox(this,CHECK_ENABLE_KEYFRAME,_("Enable")); keysEnable->SetToolTip(_("Enable snapping of subtitles to nearest keyframe, if distance is within threshold.")); keysEnable->SetValue(OPT_GET("Tool/Timing Post Processor/Enable/Keyframe")->GetBool()); wxStaticText *textStartBefore = new wxStaticText(this,-1,_("Starts before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysStartBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartBefore)); keysStartBefore->SetToolTip(_("Threshold for 'before start' distance, that is, how many frames a subtitle must start before a keyframe to snap to it.")); wxStaticText *textStartAfter = new wxStaticText(this,-1,_("Starts after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysStartAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresStartAfter)); keysStartAfter->SetToolTip(_("Threshold for 'after start' distance, that is, how many frames a subtitle must start after a keyframe to snap to it.")); wxStaticText *textEndBefore = new wxStaticText(this,-1,_("Ends before thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysEndBefore = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndBefore)); keysEndBefore->SetToolTip(_("Threshold for 'before end' distance, that is, how many frames a subtitle must end before a keyframe to snap to it.")); wxStaticText *textEndAfter = new wxStaticText(this,-1,_("Ends after thres.:"),wxDefaultPosition,wxDefaultSize,wxALIGN_CENTRE); keysEndAfter = new wxTextCtrl(this,-1,_T(""),wxDefaultPosition,wxSize(60,-1),0,NumValidator(thresEndAfter)); keysEndAfter->SetToolTip(_("Threshold for 'after end' distance, that is, how many frames a subtitle must end after a keyframe to snap to it.")); KeyframesFlexSizer->Add(keysEnable,0,wxRIGHT|wxEXPAND,10); KeyframesFlexSizer->Add(textStartBefore,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysStartBefore,0,wxRIGHT|wxEXPAND,5); KeyframesFlexSizer->Add(textStartAfter,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysStartAfter,0,wxRIGHT|wxEXPAND,0); KeyframesFlexSizer->AddStretchSpacer(1); KeyframesFlexSizer->Add(textEndBefore,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysEndBefore,0,wxRIGHT|wxEXPAND,5); KeyframesFlexSizer->Add(textEndAfter,0,wxRIGHT|wxALIGN_CENTER,5); KeyframesFlexSizer->Add(keysEndAfter,0,wxRIGHT|wxEXPAND,0); KeyframesSizer->Add(KeyframesFlexSizer,0,wxEXPAND); KeyframesSizer->AddStretchSpacer(1); // Button sizer wxStdDialogButtonSizer *ButtonSizer = new wxStdDialogButtonSizer(); ApplyButton = new wxButton(this,wxID_OK); ButtonSizer->AddButton(ApplyButton); ButtonSizer->AddButton(new wxButton(this,wxID_CANCEL)); ButtonSizer->AddButton(new HelpButton(this,_T("Timing Processor"))); ButtonSizer->Realize(); // Right Sizer wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL); RightSizer->Add(optionsSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(LeadSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(AdjacentSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(KeyframesSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->AddStretchSpacer(1); RightSizer->Add(ButtonSizer,0,wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND,0); // Style buttons sizer wxSizer *StyleButtonsSizer = new wxBoxSizer(wxHORIZONTAL); StyleButtonsSizer->Add(all,1,0,0); StyleButtonsSizer->Add(none,1,0,0); // Left sizer size_t len = StyleList->GetCount(); for (size_t i=0; i<len; i++) { StyleList->Check(i); } LeftSizer->Add(StyleList,1,wxBOTTOM|wxEXPAND,0); LeftSizer->Add(StyleButtonsSizer,0,wxEXPAND,0); // Top Sizer wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL); TopSizer->Add(LeftSizer,0,wxRIGHT|wxEXPAND,5); TopSizer->Add(RightSizer,1,wxALL|wxEXPAND,0); // Main Sizer wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); MainSizer->Add(TopSizer,1,wxALL|wxEXPAND,5); MainSizer->SetSizeHints(this); SetSizer(MainSizer); CenterOnParent(); UpdateControls(); }
header_editor_frame_c::header_editor_frame_c(wxWindow *parent) : wxFrame(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL) , m_file_menu(nullptr) , m_file_menu_sep(false) , m_page_panel(nullptr) , m_bs_main(nullptr) , m_bs_page(nullptr) , m_ignore_tree_selection_changes(false) { wxPanel *frame_panel = new wxPanel(this); m_tc_tree = new wxTreeCtrl(frame_panel, ID_HE_TC_TREE, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN | wxTR_DEFAULT_STYLE | wxTR_HIDE_ROOT | wxTR_SINGLE); //| wxTAB_TRAVERSAL); m_root_id = m_tc_tree->AddRoot(wxEmptyString); m_tc_tree->SetMinSize(wxSize(250, -1)); m_page_panel = new wxPanel(frame_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE); m_bs_page = new wxBoxSizer(wxHORIZONTAL); m_page_panel->SetSizer(m_bs_page); m_bs_main = new wxBoxSizer(wxHORIZONTAL); m_bs_main->Add(m_tc_tree, 2, wxGROW | wxALL, 5); m_bs_main->Add(m_page_panel,3, wxGROW | wxALL, 5); frame_panel->SetSizer(m_bs_main); SetMinSize(wxSize(800, 600)); clear_pages(); const wxString dummy(wxU("dummy")); m_file_menu = new wxMenu(); m_file_menu->Append(ID_M_HE_FILE_OPEN, dummy); m_file_menu->Append(ID_M_HE_FILE_SAVE, dummy); m_file_menu->Append(ID_M_HE_FILE_RELOAD, dummy); m_file_menu->Append(ID_M_HE_FILE_CLOSE, dummy); m_file_menu->AppendSeparator(); m_file_menu->Append(ID_M_HE_FILE_QUIT, dummy); m_headers_menu = new wxMenu(); m_headers_menu->Append(ID_M_HE_HEADERS_EXPAND_ALL, dummy); m_headers_menu->Append(ID_M_HE_HEADERS_COLLAPSE_ALL, dummy); m_headers_menu->AppendSeparator(); m_headers_menu->Append(ID_M_HE_HEADERS_VALIDATE, dummy); wxMenu *help_menu = new wxMenu(); help_menu->Append(ID_M_HE_HELP_HELP, dummy); wxMenuBar *menu_bar = new wxMenuBar(); menu_bar->Append(m_file_menu, dummy); menu_bar->Append(m_headers_menu, dummy); menu_bar->Append(help_menu, dummy); SetMenuBar(menu_bar); translate_ui(); enable_menu_entries(); m_status_bar = new wxStatusBar(this, wxID_ANY); SetStatusBar(m_status_bar); m_status_bar_timer.SetOwner(this, ID_T_HE_STATUS_BAR); SetIcon(wx_get_png_or_icon(mkvmergeGUI)); SetDropTarget(new header_editor_drop_target_c(this)); set_status_bar(Z("Header editor ready.")); }
// 初始化 BOOL CSettingDlg::OnInitDialog() { CDialog::OnInitDialog(); HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); SetIcon(hIcon, TRUE); // 设置大图标 SetIcon(hIcon, FALSE); // 设置小图标 // 初始化m_tab int i = 0; m_tab.InsertItem(i++, _T("首选项")); m_tab.InsertItem(i++, _T("违规内容")); m_tab.InsertItem(i++, _T("违规图片")); m_tab.InsertItem(i++, _T("屏蔽用户")); m_tab.InsertItem(i++, _T("信任用户")); m_tab.InsertItem(i++, _T("信任内容")); m_tab.InsertItem(i++, _T("方案")); m_tab.InsertItem(i++, _T("账号管理")); m_tab.InsertItem(i++, _T("关于&&更新")); // 初始化各页 m_prefPage.Create(IDD_PREF_PAGE, &m_tab); m_keywordsPage.Create(IDD_LIST_PAGE, &m_tab); m_imagePage.Create(IDD_IMAGE_PAGE, &m_tab); m_blackListPage.Create(IDD_LIST_PAGE, &m_tab); m_whiteListPage.Create(IDD_LIST_PAGE, &m_tab); m_whiteContentPage.Create(IDD_LIST_PAGE, &m_tab); m_optionsPage.Create(IDD_OPTIONS_PAGE, &m_tab); m_usersPage.Create(IDD_USERS_PAGE, &m_tab); m_aboutPage.Create(IDD_ABOUT_PAGE, &m_tab); CRect rect; m_tab.GetClientRect(&rect); rect.left += 1; rect.right -= 3; rect.top += 23; rect.bottom -= 2; m_pages[0]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW); for (i = 1; i < _countof(m_pages); i++) m_pages[i]->SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_HIDEWINDOW); // 显示配置 ShowCurrentOptions(); m_clearScanCache = FALSE; // 在m_prefPage.m_scanPageCountEdit.SetWindowText后初始化 m_optionsPage.m_currentOptionStatic.SetWindowText(_T("当前方案:") + g_currentOption); // 当前方案 // 方案 CFileFind fileFind; BOOL flag = fileFind.FindFile(OPTIONS_PATH + _T("*.tb")); while (flag) { flag = fileFind.FindNextFile(); m_optionsPage.m_list.AddString(fileFind.GetFileTitle()); } m_usersPage.m_currentUserStatic.SetWindowText(_T("当前账号:") + g_currentUser); // 当前账号 // 账号 m_usersPage.m_list.AddString(_T("[NULL]")); flag = fileFind.FindFile(USERS_PATH + _T("*")); while (flag) { flag = fileFind.FindNextFile(); if (fileFind.IsDirectory() && !fileFind.IsDots() && PathFileExists(fileFind.GetFilePath() + _T("\\ck.tb"))) { CString name = fileFind.GetFileName(); if (name != _T("[NULL]")) m_usersPage.m_list.AddString(name); } } m_aboutPage.m_autoCheckUpdateCheck.SetCheck(g_autoUpdate); // 自动更新 return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
DialogShiftTimes::DialogShiftTimes(agi::Context *context) : wxDialog(context->parent, -1, _("Shift Times")) , context(context) , history_filename(config::path->Decode("?user/shift_history.json")) , history(new json::Array) , timecodes_loaded_slot(context->videoController->AddTimecodesListener(&DialogShiftTimes::OnTimecodesLoaded, this)) , selected_set_changed_slot(context->selectionController->AddSelectionListener(&DialogShiftTimes::OnSelectedSetChanged, this)) { SetIcon(GETICON(shift_times_toolbutton_16)); // Create controls shift_by_time = new wxRadioButton(this, -1, _("&Time: "), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); shift_by_time->SetToolTip(_("Shift by time")); shift_by_time->Bind(wxEVT_COMMAND_RADIOBUTTON_SELECTED, &DialogShiftTimes::OnByTime, this); shift_by_frames = new wxRadioButton(this, -1 , _("&Frames: ")); shift_by_frames->SetToolTip(_("Shift by frames")); shift_by_frames->Bind(wxEVT_COMMAND_RADIOBUTTON_SELECTED, &DialogShiftTimes::OnByFrames, this); shift_time = new TimeEdit(this, -1, context); shift_time->SetToolTip(_("Enter time in h:mm:ss.cs notation")); shift_frames = new wxTextCtrl(this, -1); shift_frames->SetToolTip(_("Enter number of frames to shift by")); shift_forward = new wxRadioButton(this, -1, _("For&ward"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); shift_forward->SetToolTip(_("Shifts subs forward, making them appear later. Use if they are appearing too soon.")); shift_backward = new wxRadioButton(this, -1, _("&Backward")); shift_backward->SetToolTip(_("Shifts subs backward, making them appear earlier. Use if they are appearing too late.")); wxString selection_mode_vals[] = { _("&All rows"), _("Selected &rows"), _("Selection &onward") }; selection_mode = new wxRadioBox(this, -1, _("Affect"), wxDefaultPosition, wxDefaultSize, 3, selection_mode_vals, 1); wxString time_field_vals[] = { _("Start a&nd End times"), _("&Start times only"), _("&End times only") }; time_fields = new wxRadioBox(this, -1, _("Times"), wxDefaultPosition, wxDefaultSize, 3, time_field_vals, 1); history_box = new wxListBox(this, -1, wxDefaultPosition, wxSize(350, 100), 0, nullptr, wxLB_HSCROLL); wxButton *clear_button = new wxButton(this, -1, _("&Clear")); clear_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::OnClear, this); // Set initial control states OnTimecodesLoaded(context->videoController->FPS()); OnSelectedSetChanged(); LoadHistory(); shift_time->SetTime(OPT_GET("Tool/Shift Times/Time")->GetInt()); *shift_frames << (int)OPT_GET("Tool/Shift Times/Frames")->GetInt(); shift_by_frames->SetValue(!OPT_GET("Tool/Shift Times/ByTime")->GetBool() && shift_by_frames->IsEnabled()); time_fields->SetSelection(OPT_GET("Tool/Shift Times/Type")->GetInt()); selection_mode->SetSelection(OPT_GET("Tool/Shift Times/Affect")->GetInt()); shift_backward->SetValue(OPT_GET("Tool/Shift Times/Direction")->GetBool()); if (shift_by_frames->GetValue()) shift_time->Disable(); else shift_frames->Disable(); // Position controls wxSizer *shift_amount_sizer = new wxFlexGridSizer(2, 2, 5, 5); shift_amount_sizer->Add(shift_by_time, wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL)); shift_amount_sizer->Add(shift_time, wxSizerFlags(1)); shift_amount_sizer->Add(shift_by_frames, wxSizerFlags(0).Align(wxALIGN_CENTER_VERTICAL)); shift_amount_sizer->Add(shift_frames, wxSizerFlags(1)); wxSizer *shift_direction_sizer = new wxBoxSizer(wxHORIZONTAL); shift_direction_sizer->Add(shift_forward, wxSizerFlags(1).Expand()); shift_direction_sizer->Add(shift_backward, wxSizerFlags(1).Expand().Border(wxLEFT)); wxSizer *shift_by_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Shift by")); shift_by_sizer->Add(shift_amount_sizer, wxSizerFlags().Expand()); shift_by_sizer->Add(shift_direction_sizer, wxSizerFlags().Expand().Border(wxTOP)); wxSizer *left_sizer = new wxBoxSizer(wxVERTICAL); left_sizer->Add(shift_by_sizer, wxSizerFlags().Expand().Border(wxBOTTOM)); left_sizer->Add(selection_mode, wxSizerFlags().Expand().Border(wxBOTTOM)); left_sizer->Add(time_fields, wxSizerFlags().Expand()); wxSizer *history_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Load from history")); history_sizer->Add(history_box, wxSizerFlags(1).Expand()); history_sizer->Add(clear_button, wxSizerFlags().Expand().Border(wxTOP)); wxSizer *top_sizer = new wxBoxSizer(wxHORIZONTAL); top_sizer->Add(left_sizer, wxSizerFlags().Border(wxALL & ~wxRIGHT).Expand()); top_sizer->Add(history_sizer, wxSizerFlags().Border().Expand()); wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(top_sizer, wxSizerFlags().Border(wxALL & ~wxBOTTOM)); main_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL | wxHELP), wxSizerFlags().Right().Border()); SetSizerAndFit(main_sizer); CenterOnParent(); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &DialogShiftTimes::Process, this, wxID_OK); Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&HelpButton::OpenPage, "Shift Times"), wxID_HELP); shift_time->Bind(wxEVT_COMMAND_TEXT_ENTER, &DialogShiftTimes::Process, this); history_box->Bind(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &DialogShiftTimes::OnHistoryClick, this); }
BOOL CTrayNotifyIcon::SetIcon(UINT nIDResource) { HICON hIcon = LoadIconResource(nIDResource); return SetIcon(hIcon); }
LRESULT CConfigDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // // Center dialog // CenterWindow(); // // Set icons // HICON hIcon = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)); SetIcon(hIcon, TRUE); HICON hIconSmall = AtlLoadIconImage(IDR_MAINFRAME, LR_DEFAULTCOLOR, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)); SetIcon(hIconSmall, FALSE); // // Profile path // { BOOL bSuccess = SetDlgItemText(IDC_PROFILE_PATH, m_strProfilePath); ATLASSERT(bSuccess); } // // Tracker port // { BOOL bSuccess = SetDlgItemInt(IDC_TRACKER_PORT, m_nTrackerPort, FALSE); ATLASSERT(bSuccess); // Limit input to 5 digits SendDlgItemMessage(IDC_TRACKER_PORT, EM_LIMITTEXT, 5, 0); } // // Display port // { BOOL bSuccess = SetDlgItemInt(IDC_CAPTURE_PORT, m_nDisplayPort, FALSE); ATLASSERT(bSuccess); // Limit input to 5 digits SendDlgItemMessage(IDC_CAPTURE_PORT, EM_LIMITTEXT, 5, 0); } // // Compression level // { BOOL bSuccess = SetDlgItemInt(IDC_COMPRESSION_LVL, m_nCompressionLvl, FALSE); ATLASSERT(bSuccess); // Limit input to 3 digits SendDlgItemMessage(IDC_COMPRESSION_LVL, EM_LIMITTEXT, 3, 0); } return TRUE; }
BOOL CTrayNotifyIcon::SetStandardIcon(UINT nIDResource) { HICON hIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(nIDResource)); return SetIcon(hIcon); }
FrameMain::FrameMain() : wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN) , context(agi::util::make_unique<agi::Context>()) { StartupLog("Entering FrameMain constructor"); #ifdef __WXGTK__ // XXX HACK XXX // We need to set LC_ALL to "" here for input methods to work reliably. setlocale(LC_ALL, ""); // However LC_NUMERIC must be "C", otherwise some parsing fails. setlocale(LC_NUMERIC, "C"); #endif #ifdef __APPLE__ // When run from an app bundle, LC_CTYPE defaults to "C", which breaks on // anything involving unicode and in some cases number formatting. // The right thing to do here would be to query CoreFoundation for the user's // locale and add .UTF-8 to that, but :effort: LOG_D("locale") << setlocale(LC_ALL, nullptr); setlocale(LC_CTYPE, "en_US.UTF-8"); LOG_D("locale") << setlocale(LC_ALL, nullptr); #endif StartupLog("Initializing context models"); memset(context.get(), 0, sizeof(*context)); context->ass = new AssFile; StartupLog("Initializing context controls"); context->subsController = new SubsController(context.get()); context->ass->AddCommitListener(&FrameMain::UpdateTitle, this); context->subsController->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this); context->subsController->AddFileSaveListener(&FrameMain::UpdateTitle, this); context->audioController = new AudioController(context.get()); context->audioController->AddAudioOpenListener(&FrameMain::OnAudioOpen, this); context->audioController->AddAudioCloseListener(&FrameMain::OnAudioClose, this); context->local_scripts = new Automation4::LocalScriptManager(context.get()); // Initialized later due to that the selection controller is currently the subtitles grid context->selectionController = nullptr; context->videoController = VideoContext::Get(); // derp context->videoController->AddVideoOpenListener(&FrameMain::OnVideoOpen, this); StartupLog("Initializing context frames"); context->parent = this; context->previousFocus = nullptr; StartupLog("Install PNG handler"); wxImage::AddHandler(new wxPNGHandler); #ifndef __APPLE__ wxSafeYield(); #endif StartupLog("Apply saved Maximized state"); if (OPT_GET("App/Maximized")->GetBool()) Maximize(true); StartupLog("Initialize toolbar"); InitToolbar(); StartupLog("Initialize menu bar"); menu::GetMenuBar("main", this, context.get()); StartupLog("Create status bar"); CreateStatusBar(2); StartupLog("Set icon"); #ifdef _WIN32 SetIcon(wxICON(wxicon)); #else wxIcon icon; icon.CopyFromBitmap(GETIMAGE(wxicon)); SetIcon(icon); #endif StartupLog("Create views and inner main window controls"); context->dialog = new DialogManager; InitContents(); OPT_SUB("Video/Detached/Enabled", &FrameMain::OnVideoDetach, this, agi::signal::_1); StartupLog("Complete context initialization"); context->videoController->SetContext(context.get()); StartupLog("Set up drag/drop target"); SetDropTarget(new AegisubFileDropTarget(this)); StartupLog("Load default file"); context->subsController->Close(); StartupLog("Display main window"); AddFullScreenButton(this); Show(); SetDisplayMode(1, 1); // Version checker StartupLog("Possibly perform automatic updates check"); if (OPT_GET("App/First Start")->GetBool()) { OPT_SET("App/First Start")->SetBool(false); #ifdef WITH_UPDATE_CHECKER int result = wxMessageBox(_("Do you want Aegisub to check for updates whenever it starts? You can still do it manually via the Help menu."),_("Check for updates?"), wxYES_NO | wxCENTER); OPT_SET("App/Auto/Check For Updates")->SetBool(result == wxYES); config::opt->Flush(); #endif } #ifdef WITH_UPDATE_CHECKER PerformVersionCheck(false); #endif Bind(FILE_LIST_DROPPED, &FrameMain::OnFilesDropped, this); StartupLog("Leaving FrameMain constructor"); }
LyricsWindow::LyricsWindow(AudacityProject *parent): wxFrame(parent, -1, wxString::Format(_("Audacity Karaoke%s"), ((parent->GetName() == wxEmptyString) ? wxT("") : wxString::Format( wxT(" - %s"), parent->GetName().c_str()).c_str())), wxPoint(100, 300), gSize, //v Bug in wxFRAME_FLOAT_ON_PARENT: // If both the project frame and LyricsWindow are minimized and you restore LyricsWindow, // you can't restore project frame until you close LyricsWindow, but then project frame and // LyricsWindow are restored but LyricsWindow is unresponsive because it thinks it's not shown. // wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT) wxDEFAULT_FRAME_STYLE) { //vvv Still necessary? It's commented out in ToolManager and Meter, so I did so here. // #ifdef __WXMAC__ // // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do // SetWindowClass((WindowRef) MacGetWindowRef(), kFloatingWindowClass); // #endif mProject = parent; // loads either the XPM or the windows resource, depending on the platform #if !defined(__WXMAC__) && !defined(__WXX11__) wxIcon *ic; #ifdef __WXMSW__ ic = new wxIcon(wxICON(AudacityLogo)); #else ic = new wxIcon(wxICON(AudacityLogo48x48)); #endif SetIcon(*ic); delete ic; #endif wxPoint panelPos(0, 0); wxSize panelSize = gSize; //vvv not yet working right in ported version, so choice is disabled. // It seems when you select highlight style, the TrackPanel timer stops working, but // going back to bouncing ball style starts it up again (!!!), per breakpoints in TrackPanel::OnTimer(). // //wxToolBar* pToolBar = this->CreateToolBar(); //const int kHorizMargin = 8; //wxRadioButton* pRadioButton_BouncingBall = // new wxRadioButton(pToolBar, kID_RadioButton_BouncingBall, _("Bouncing Ball"), wxPoint(kHorizMargin, 4), // wxDefaultSize, wxRB_GROUP); //// Reposition to center vertically. //wxSize tbSize = pToolBar->GetSize(); //wxSize btnSize = pRadioButton_BouncingBall->GetSize(); //int top = (tbSize.GetHeight() - btnSize.GetHeight()) / 2; //pRadioButton_BouncingBall->Move(kHorizMargin, top); //pToolBar->AddControl(pRadioButton_BouncingBall); // //int left = kHorizMargin + btnSize.GetWidth() + kHorizMargin; //vvv Doesn't actually work. Probably need sizers. //wxRadioButton* pRadioButton_Highlight = // new wxRadioButton(pToolBar, kID_RadioButton_Highlight, _("Highlight"), wxPoint(left, top)); //pToolBar->AddControl(pRadioButton_Highlight); // //panelPos.x += tbSize.GetHeight(); //panelSize.y -= tbSize.GetHeight(); // //#if defined(__WXMAC__) // wxColour face = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); // pRadioButton_BouncingBall->SetBackgroundColour(face); // pRadioButton_Highlight->SetBackgroundColour(face); //#endif // //pToolBar->Realize(); mLyricsPanel = new Lyrics(this, -1, panelPos, panelSize); //vvv Highlight style is broken in ported version. //switch (mLyricsPanel->GetLyricsStyle()) //{ // case Lyrics::kBouncingBallLyrics: // pRadioButton_BouncingBall->SetValue(true); break; // case Lyrics::kHighlightLyrics: // default: // pRadioButton_Highlight->SetValue(true); break; //} }
//! @brief Constructor //! //! @param parent Parent window ConnectWindow::ConnectWindow( wxWindow* parent, Ui& ui ) : wxDialog( parent, -1, _("Connect to lobby server"), wxDefaultPosition, wxSize(300, 300), wxDEFAULT_DIALOG_STYLE | wxCLIP_CHILDREN ), m_ui(ui) { wxString server; wxString username; wxString password; bool savepass; bool autoconnect; SetIcon( wxIcon(connect_xpm) ); server = sett().GetDefaultServer(); username = sett().GetServerAccountNick( sett().GetDefaultServer() ); password = sett().GetServerAccountPass( sett().GetDefaultServer() ); savepass = sett().GetServerAccountSavePass( sett().GetDefaultServer() ); autoconnect = sett().GetAutoConnect(); // Create all UI elements. m_tabs = new wxNotebook( this , -1 ); m_login_tab = new wxPanel ( m_tabs, -1 ); m_register_tab = new wxPanel ( m_tabs, -1 ); m_server_lbl = new wxStaticText( m_login_tab, -1, _("Server") ); m_server_combo = new wxComboBox ( m_login_tab, CON_SERV_SEL, server ); m_server_combo->SetToolTip( TE(_("Server to connect to. You can connect to any server you like by typing in hostaddress:port format.")) ); m_ser_acc_line = new wxStaticLine( m_login_tab ); m_nick_lbl = new wxStaticText( m_login_tab, -1, _("Nickname") ); m_nick_text = new wxTextCtrl ( m_login_tab, -1, username ); m_pass_lbl = new wxStaticText( m_login_tab, -1, _("Password") ); m_pass_text = new wxTextCtrl ( m_login_tab, -1, password, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); m_rpass_check = new wxCheckBox ( m_login_tab, -1, _("Remember password") ); m_autoconnect_check = new wxCheckBox ( m_login_tab, -1, _("Autoconnect next time") ); m_autoconnect_check->SetToolTip( TE(_("remember connection details and automatically connect to server on next lobby startup")) ); wxToolTip::Enable( false ); m_rpass_check->SetValue( savepass ); m_autoconnect_check->SetValue( autoconnect ); m_acc_note_line = new wxStaticLine( m_login_tab ); m_note_lbl = new wxStaticText( m_login_tab, -1, _("Note: If you do not have an account, you\n can register one for free on the\n\"Register\" tab.") ); m_ok_btn = new wxButton( this, wxID_OK, _("Ok") ); m_cancel_btn = new wxButton( this, wxID_CANCEL, _("Cancel") ); // Add tabs to tab control. m_tabs->AddPage( m_login_tab, _("Login"), true ); m_tabs->AddPage( m_register_tab, _("Register"), false ); // Create sizers. m_main_sizer = new wxBoxSizer( wxVERTICAL ); m_login_main_sizer = new wxBoxSizer( wxVERTICAL ); m_server_sizer = new wxBoxSizer( wxHORIZONTAL ); m_nick_sizer = new wxBoxSizer( wxHORIZONTAL ); m_pass_sizer = new wxBoxSizer( wxHORIZONTAL ); m_rpass_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* m_check_sizer = new wxBoxSizer( wxHORIZONTAL ); m_buttons_sizer = new wxStdDialogButtonSizer(); // Add UI elements to sizers. m_buttons_sizer->Add( m_ok_btn ); m_buttons_sizer->AddStretchSpacer(); m_buttons_sizer->Add( m_cancel_btn ); m_rpass_sizer->Add( m_rpass_check, 2, wxEXPAND | wxALL | wxALIGN_RIGHT, 4 ); m_rpass_sizer->Add( m_autoconnect_check, 2, wxEXPAND | wxALL | wxALIGN_RIGHT, 4 ); m_pass_sizer->Add( m_pass_lbl, 1, wxALL | wxALIGN_CENTER_VERTICAL, 4 ); m_pass_sizer->Add( m_pass_text, 2, wxEXPAND | wxALL, 4 ); //FIXME was lazy, absoulte positioning isn't that nice //probably causing http://springlobby.info/issues/1094 int pos1 = (m_pass_lbl->GetSize()).GetWidth() + 40; m_check_sizer->Add(pos1,0,0); m_check_sizer->Add( m_rpass_sizer, 0, wxEXPAND | wxALIGN_RIGHT); m_nick_sizer->Add( m_nick_lbl, 1, wxALL | wxALIGN_CENTER_VERTICAL, 4 ); m_nick_sizer->Add( m_nick_text, 2, wxEXPAND | wxALL, 4 ); m_server_sizer->Add( m_server_lbl, 1, wxALL | wxALIGN_CENTER_VERTICAL, 4 ); m_server_sizer->Add( m_server_combo, 2, wxEXPAND | wxALL, 4 ); m_login_main_sizer->Add( m_server_sizer, 0, wxEXPAND | wxALL, 0 ); m_login_main_sizer->Add( m_ser_acc_line, 0, wxEXPAND | wxALL, 4 ); m_login_main_sizer->Add( m_nick_sizer, 0, wxEXPAND ); m_login_main_sizer->Add( m_pass_sizer, 0, wxEXPAND ); m_login_main_sizer->Add( m_check_sizer, 0, wxEXPAND ); m_login_main_sizer->Add( m_acc_note_line, 0, wxEXPAND | wxALL, 4 ); m_login_main_sizer->Add( m_note_lbl, 0, wxEXPAND | wxALL, 4 ); m_login_main_sizer->AddStretchSpacer(); m_login_tab->SetSizer( m_login_main_sizer ); m_main_sizer->Add( m_tabs, 1, wxEXPAND ); m_main_sizer->Add( m_buttons_sizer, 0, wxEXPAND ); // Register page wxBoxSizer* m_register_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* m_regnick_sizer = new wxBoxSizer( wxHORIZONTAL ); m_regnick_lbl = new wxStaticText( m_register_tab, wxID_ANY, _("Nick"), wxDefaultPosition, wxDefaultSize, 0 ); m_regnick_sizer->Add( m_regnick_lbl, 1, wxALL | wxALIGN_CENTER_VERTICAL, 4 ); m_regnick_text = new wxTextCtrl( m_register_tab, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_regnick_sizer->Add( m_regnick_text, 1, wxALL, 4 ); m_register_sizer->Add( m_regnick_sizer, 0, wxEXPAND, 4 ); m_regpass_sep = new wxStaticLine( m_register_tab, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_register_sizer->Add( m_regpass_sep, 0, wxALL|wxEXPAND, 4 ); wxBoxSizer* m_regpass1_sizer = new wxBoxSizer( wxHORIZONTAL ); m_regpass1_lbl = new wxStaticText( m_register_tab, wxID_ANY, _("Password"), wxDefaultPosition, wxDefaultSize, 0 ); m_regpass1_sizer->Add( m_regpass1_lbl, 1, wxALL | wxALIGN_CENTER_VERTICAL, 4 ); m_regpass1_text = new wxTextCtrl( m_register_tab, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); m_regpass1_sizer->Add( m_regpass1_text, 1, wxALL, 4 ); m_register_sizer->Add( m_regpass1_sizer, 0, wxEXPAND, 4 ); wxBoxSizer* m_regpass1_sizer1 = new wxBoxSizer( wxHORIZONTAL ); m_regpass2_lbl = new wxStaticText( m_register_tab, wxID_ANY, wxT("Retype password"), wxDefaultPosition, wxDefaultSize, 0 ); m_regpass1_sizer1->Add( m_regpass2_lbl, 1, wxALL | wxALIGN_CENTER_VERTICAL, 4 ); m_regpass2_text = new wxTextCtrl( m_register_tab, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); m_regpass1_sizer1->Add( m_regpass2_text, 1, wxALL, 4 ); m_register_sizer->Add( m_regpass1_sizer1, 0, wxEXPAND, 4 ); m_register_tab->SetSizer( m_register_sizer ); m_register_tab->Layout(); m_register_sizer->Fit( m_register_tab ); // Set sizer. SetSizer( m_main_sizer ); if ( !username.empty() ) { m_ok_btn->SetFocus(); } else { m_nick_text->SetFocus(); } m_ok_btn->SetDefault(); Layout(); m_main_sizer->SetSizeHints( this ); #ifdef __WXMSW__ SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); #endif ReloadServerList(); }