GLIDebugVariableGrid::GLIDebugVariableGrid(wxWindow *parent, wxWindowID id, uint displayFlags, const wxPoint& pos, const wxSize& size, long style, const wxString& name): wxGrid(parent, id, pos, size, style, name), gridFlags(displayFlags), internalCellEditCounter(0) { //Create a drag target SetDropTarget(new GridDnDText(this)); //Create the grid of 3 columns CreateGrid(0, 3, wxGrid::wxGridSelectRows); //Set the label values SetColLabelValue(NAME_COLUMN_INDEX, wxT("Name")); SetColLabelValue(VALUE_COLUMN_INDEX, wxT("Value")); SetColLabelValue(TYPE_COLUMN_INDEX, wxT("Type")); SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_TOP); SetColLabelSize(17); //Set the column sizes SetColSize(NAME_COLUMN_INDEX, 125); SetColSize(VALUE_COLUMN_INDEX, 200); SetColSize(TYPE_COLUMN_INDEX, 115); //Turn off row labels SetRowLabelSize(0); //Turn off cell overflowing SetDefaultCellOverflow(false); //Setup default colours SetDefaultCellBackgroundColour(*wxWHITE); SetDefaultCellTextColour (*wxBLACK); SetGridLineColour (gridGrey); SetLabelBackgroundColour(gridGrey); SetLabelTextColour (*wxBLACK); }
SubMainFrame::SubMainFrame( wxWindow* parent, int id, wxString title, wxPoint pos, wxSize size, int style ) : MainFrame( parent, id, title, pos, size, style ) { //Set the target fro droping file onto the application SetDropTarget(new DnDFile()); //Store the Recent Projects menu in the inherited class wxMenu *fileMenu = GetMenuBar()->GetMenu(0); wxMenuItem * emptyItem = fileMenu->FindItem(IDX_MENU_EMPTY, &m_menuRecentImages); UpdateHistory(); int statusWidths[] = {-2,-1, -1, -1}; GetStatusBar()->SetStatusWidths(4, statusWidths ); Init(); }
main_listctrl::main_listctrl( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name ) : wxListCtrl( parent, id, pos, size, style, validator, name ) { m_parent = parent; // This listctrl needs to insert its columns in the constructor, since as soon // as the listctrl is built, it is resized and grafted onto an "unknown" XRC // placeholder. This induces an OnSize() event, calling the overrriden OnSize function for // this class, which needs to have 3 columns to resize (else an assert on WXGTK debug // build). InsertColumn( NAME_COLUMN, _( "Channel name" ), wxLIST_FORMAT_LEFT, 160 ); InsertColumn( DUE_COLUMN, _( "Due" ), wxLIST_FORMAT_LEFT, 100 ); #if ( setupUSE_DRAG_AND_DROP ) // Associate a filename drop targets with this listctrl SetDropTarget( new dnd_file( this ) ); #endif }
CLocalTreeView::CLocalTreeView(wxWindow* parent, wxWindowID id, CState *pState, CQueueView *pQueueView) : wxTreeCtrl(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER), CSystemImageList(16), CStateEventHandler(pState, STATECHANGE_LOCAL_DIR | STATECHANGE_APPLYFILTER), m_pQueueView(pQueueView) { m_setSelection = false; SetImageList(GetSystemImageList()); #ifdef __WXMSW__ m_pVolumeEnumeratorThread = 0; CreateRoot(); #else AddRoot(_T("/"), GetIconIndex(dir), GetIconIndex(opened_dir)); SetDir(_T("/")); #endif SetDropTarget(new CLocalTreeViewDropTarget(this)); }
FaceFrame::FaceFrame() : wxFrame(NULL, -1, _T("XFaceEd"), wxDefaultPosition, wxSize(1024, 768)), m_dictionaryDlg(0) { wxFileSystem::AddHandler(new wxZipFSHandler); m_help.AddBook(wxFileName(_T("./help.zip"))); wxImage::AddHandler(new wxPNGHandler()); wxIcon icon; bool test = icon.LoadFile(_T("./res/XFaceLogo.ico"), wxBITMAP_TYPE_ICO ); SetIcons(wxIconBundle(icon)); // set the frame icon // SetIcon(icon); SetStatusBar(CreateStatusBar(2)); createMenu(); m_splitter = new Splitter(this); try{ m_GLwnd = new FaceView(m_splitter); m_GLwnd->Refresh(); Mediator::getInstance()->regFaceView(m_GLwnd); } catch(...) { wxMessageBox(_T("Unable to create OpenGL window, you might have a problem with your video card drivers!"), _T("Exception")); Close(true); } m_panel = new LeftPanel(m_splitter, 0, 0, 350, 768); m_panel->InitDialog(); m_splitter->SplitVertically(m_panel, m_GLwnd, 350); //m_splitter->SetMinimumPaneSize(300); SetDropTarget(new DropFDPFileTarget); SetTitle(_T("XfaceEd - No file loaded!")); }
clTreeCtrlPanel::clTreeCtrlPanel(wxWindow* parent) : clTreeCtrlPanelBase(parent) , m_config(NULL) , m_newfileTemplate("Untitled.txt") , m_newfileTemplateHighlightLen(wxStrlen("Untitled")) , m_options(kShowHiddenFiles | kShowHiddenFolders) { ::MSWSetNativeTheme(GetTreeCtrl()); // Allow DnD SetDropTarget(new clFileOrFolderDropTarget(this)); GetTreeCtrl()->SetDropTarget(new clFileOrFolderDropTarget(this)); Bind(wxEVT_DND_FOLDER_DROPPED, &clTreeCtrlPanel::OnFolderDropped, this); GetTreeCtrl()->AddRoot(_("Folders"), wxNOT_FOUND, wxNOT_FOUND, new clTreeCtrlData(clTreeCtrlData::kRoot)); GetTreeCtrl()->AssignImageList(m_bmpLoader.MakeStandardMimeImageList()); EventNotifier::Get()->Bind(wxEVT_ACTIVE_EDITOR_CHANGED, &clTreeCtrlPanel::OnActiveEditorChanged, this); EventNotifier::Get()->Bind(wxEVT_INIT_DONE, &clTreeCtrlPanel::OnInitDone, this); m_defaultView = new clTreeCtrlPanelDefaultPage(this); GetSizer()->Add(m_defaultView, 1, wxEXPAND); GetTreeCtrl()->Hide(); }
CSourcesListBox::CSourcesListBox( wxWindow* parent ) : CMusikListCtrl( parent, MUSIK_SOURCES_LISTCTRL, wxPoint( -1, -1 ), wxSize( -1, -1 ), wxLC_ALIGN_LEFT |wxLC_EDIT_LABELS | wxLC_SINGLE_SEL | wxNO_BORDER|wxLC_NO_SORT_HEADER) { #ifdef __WXMSW__ m_bHideHorzScrollbar = true; #endif //--- initialize variables ---// m_CurSel = 0; m_DragIndex = -1; HaveDelayedSELCHANGED = false; InsertColumn( 0, _( "Sources" ), wxLIST_FORMAT_LEFT ); SetDropTarget( new SourcesDropTarget( this ) ); m_Deleting = false; ShowIcons(); Load(); RescanPlaylistDir(); Update(); }
StagePanel::StagePanel(wxWindow* parent, wxTopLevelWindow* frame, ee::PropertySettingPanel* property, LibraryPanel* library) : EditPanel(parent, frame) , ee::SpritesPanelImpl(GetStageImpl()) , m_sym() , m_library(library) { m_sym = std::make_shared<Symbol>(); SetContainer(std::make_shared<SymbolContainer>(m_sym)); SetEditOP(std::make_shared<ee::ArrangeSpriteOP<SelectSpritesOP>>( this, GetStageImpl(), this, property, nullptr, ee::ArrangeSpriteConfig(), new ArrangeSpriteImpl(this, property))); SetCanvas(std::make_shared<StageCanvas>(this, library)); SetDropTarget(new ee::StageDropTarget(this, GetStageImpl(), library)); ee::MODULE_STAGE.impl = this; RegistSubject(ee::ClearSpriteSJ::Instance()); }
Frame::Frame(const std::string& title, const std::string& filetag, const wxSize& size, bool maxmize) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, size, wxDEFAULT_FRAME_STYLE | (wxMAXIMIZE * maxmize)) , m_task(NULL) , m_filetag(filetag) , m_recent_menu(new RecentFilesMenu(ID_RECENT_FILENAME)) , m_config(filetag) { LoadWindowConfig(); LoadTmpInfo(); InitMenuBar(); InitStatueBar(); #ifdef _DEBUG wxLog::SetActiveTarget(new wxLogWindow(this, _T("Log window"))); m_log_chain = new wxLogChain(new wxLogStderr); #else wxLog::SetLogLevel(0); #endif StackTrace::InitUnhandledExceptionFilter(); SetDropTarget(new FrameDropTarget(this)); }
WFileList::WFileList(class WCryptoTE* parent) : wxListCtrl(parent, wxID_ANY), wmain(parent) { metasettings.show_filename = metasettings.show_size = metasettings.show_compressed = metasettings.show_compression = metasettings.show_encryption = metasettings.show_mtime = metasettings.show_ctime = metasettings.show_author = metasettings.show_subject = 50; UpdateDisplayMode(0); droptarget = new WFileListDropTarget(parent); SetDropTarget(droptarget); BuildImageList(); LoadProperties(); }
StagePanel::StagePanel(wxWindow* parent, wxTopLevelWindow* frame, const std::shared_ptr<Symbol>& sym, ee::PropertySettingPanel* property, LibraryPanel* library, wxGLContext* glctx, ee::CrossGuides* guides) : EditPanel(parent, frame) , m_sym(sym) , ee::SpritesPanelImpl(GetStageImpl()) , m_library(library) { SetContainer(std::make_shared<SymbolContainer>(m_sym)); auto editop = std::make_shared<ee::ArrangeSpriteOP<SelectSpritesOP>>( this, GetStageImpl(), this, property, nullptr, ee::ArrangeSpriteConfig(), new ArrangeSpriteImpl(this, property)); std::dynamic_pointer_cast<SelectSpritesOP>(editop)->SetGuides(guides); SetEditOP(editop); SetCanvas(std::make_shared<StageCanvas>(this, library, glctx)); SetDropTarget(new ee::StageDropTarget(this, GetStageImpl(), library)); RegistSubject(ee::ClearSpriteSJ::Instance()); }
IconPanel::IconPanel(wxWindow *owner, int id, wxPoint point, wxSize size): NineSlicesPanel(owner, id, point, size) { rotated_ = false; IconPanelDropTarget* dropTarget = new IconPanelDropTarget(); dropTarget->SetAssociatedIconPanel(this); SetDropTarget(dropTarget); folderItemSource_ = ICON_PANEL_SOURCE_USER; firstOffScreenIconIndex_ = -1; // Means all the icons are visible layoutInvalidated_ = true; iconsInvalidated_ = true; browseButton_ = new ImageButton(this); browseButton_->Hide(); browseButton_->SetCursor(wxCursor(wxCURSOR_HAND)); browseButton_->Connect( wxID_ANY, wxeEVT_CLICK, wxCommandEventHandler(IconPanel::OnBrowseButtonClick), NULL, this); }
CRemoteTreeView::CRemoteTreeView(wxWindow* parent, wxWindowID id, CState* pState, CQueueView* pQueue) : wxTreeCtrlEx(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER | wxTR_HIDE_ROOT), CSystemImageList(16), CStateEventHandler(pState) { #ifdef __WXMAC__ SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #endif pState->RegisterHandler(this, STATECHANGE_REMOTE_DIR); pState->RegisterHandler(this, STATECHANGE_REMOTE_DIR_MODIFIED); pState->RegisterHandler(this, STATECHANGE_APPLYFILTER); m_busy = false; m_pQueue = pQueue; AddRoot(_T("")); m_ExpandAfterList = wxTreeItemId(); CreateImageList(); SetDropTarget(new CRemoteTreeViewDropTarget(this)); Enable(false); }
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"); }
CLocalListView::CLocalListView(wxWindow* parent, wxWindowID id, CState *pState, CQueueView *pQueue) : wxListCtrl(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxLC_VIRTUAL | wxLC_REPORT | wxNO_BORDER | wxLC_EDIT_LABELS), CSystemImageList(16), CStateEventHandler(pState, STATECHANGE_LOCAL_DIR | STATECHANGE_APPLYFILTER | STATECHANGE_LOCAL_REFRESH_FILE) { m_dropTarget = -1; m_hasParent = true; m_pQueue = pQueue; unsigned long widths[4] = { 120, 80, 100, 120 }; if (!wxGetKeyState(WXK_SHIFT) || !wxGetKeyState(WXK_ALT) || !wxGetKeyState(WXK_CONTROL)) COptions::Get()->ReadColumnWidths(OPTION_LOCALFILELIST_COLUMN_WIDTHS, 4, widths); InsertColumn(0, _("Filename"), wxLIST_FORMAT_LEFT, widths[0]); InsertColumn(1, _("Filesize"), wxLIST_FORMAT_RIGHT, widths[1]); InsertColumn(2, _("Filetype"), wxLIST_FORMAT_LEFT, widths[2]); InsertColumn(3, _("Last modified"), wxLIST_FORMAT_LEFT, widths[3]); wxString sortInfo = COptions::Get()->GetOption(OPTION_LOCALFILELIST_SORTORDER); m_sortDirection = sortInfo[0] - '0'; if (m_sortDirection < 0 || m_sortDirection > 1) m_sortDirection = 0; if (sortInfo.Len() == 3) { m_sortColumn = sortInfo[2] - '0'; if (m_sortColumn < 0 || m_sortColumn > 3) m_sortColumn = 0; } else m_sortColumn = 0; SetImageList(GetSystemImageList(), wxIMAGE_LIST_SMALL); #ifdef __WXMSW__ // Initialize imagelist for list header m_pHeaderImageList = new wxImageListEx(8, 8, true, 3); wxBitmap bmp; bmp.LoadFile(wxGetApp().GetResourceDir() + _T("empty.png"), wxBITMAP_TYPE_PNG); m_pHeaderImageList->Add(bmp); bmp.LoadFile(wxGetApp().GetResourceDir() + _T("up.png"), wxBITMAP_TYPE_PNG); m_pHeaderImageList->Add(bmp); bmp.LoadFile(wxGetApp().GetResourceDir() + _T("down.png"), wxBITMAP_TYPE_PNG); m_pHeaderImageList->Add(bmp); HWND hWnd = (HWND)GetHandle(); if (!hWnd) { delete m_pHeaderImageList; m_pHeaderImageList = 0; return; } HWND header = (HWND)SendMessage(hWnd, LVM_GETHEADER, 0, 0); if (!header) { delete m_pHeaderImageList; m_pHeaderImageList = 0; return; } TCHAR buffer[1000] = {0}; HDITEM item; item.mask = HDI_TEXT; item.pszText = buffer; item.cchTextMax = 999; SendMessage(header, HDM_GETITEM, 0, (LPARAM)&item); SendMessage(header, HDM_SETIMAGELIST, 0, (LPARAM)m_pHeaderImageList->GetHandle()); #endif SetDropTarget(new CLocalListViewDropTarget(this)); #if (!defined(__WIN32__) && !defined(__WXMAC__)) || defined(__WXUNIVERSAL__) // The generic list control a scrolled child window. In order to receive // scroll events, we have to connect the event handler to it. ((wxWindow*)m_mainWin)->Connect(-1, wxEVT_KEY_DOWN, wxKeyEventHandler(CLocalListView::OnKeyDown), 0, this); #endif }
void GamessQFrame::CreateControls() { ////@begin GamessQFrame content construction GamessQFrame* itemFrame1 = this; wxMenuBar* menuBar = new wxMenuBar; AppMenu = new wxMenu; AppMenu->Append(wxID_PREFERENCES, _("&Preferences"), _("Change the way GamessQ behaves"), wxITEM_NORMAL); AppMenu->Append(ID_PAUSEALL, _("&Pause All"), _("Pause Everything"), wxITEM_CHECK); AppMenu->AppendSeparator(); AppMenu->Append(wxID_EXIT, _("E&xit"), _("Exit GamessQ"), wxITEM_NORMAL); menuBar->Append(AppMenu, _("&Queue")); jobsMenu = new wxMenu; { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_ADD, _("&Add Jobs\tCtrl+A"), _("Add new GAMESS jobs to the end of the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_REMOVE, _("Remove Jobs"), _("Remove the selected GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CANCEL, _("&Cancel Jobs"), _("Cancel the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_PAUSE, _("&Pause Jobs\tCtrl+P"), _("Pause the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_RESUME, _("&Resume Jobs\tCtrl+R"), _("Resume the selected paused GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEFOLDER, _("Save Output to Folder\tCtrl+S"), _("Save GAMESS output for selected jobs to a folder"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSave"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEAS, _("Save Output As..."), _("Save GAMESS output for this job"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSaveAs"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->Append(ID_MACMOLPLT, _("Open in wxMacMolPlt\tCtrl+O"), _T(""), wxITEM_NORMAL); jobsMenu->Append(ID_VIEWLOGS, _("View &Logs"), _("View the GAMESS log files for the selected jobs"), wxITEM_NORMAL); jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_REFRESH, _("Refresh\tAlt-R"), _("Refresh the display of the queue status"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CLEAR, _("Clean Up"), _("Clear all finished GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } menuBar->Append(jobsMenu, _("&Jobs")); //Yes this is a complete copy of the menu that was just added to the Menubar. At least in //wx 3.0 wx throws an assertion saying that a popupmenu is not supposed to be attached to //another menu or menubar. So after attaching the previous copy recreate it. The copy //attached to the menu is now "owned" by the Menu/window. jobsMenu = new wxMenu; { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_ADD, _("&Add Jobs\tCtrl+A"), _("Add new GAMESS jobs to the end of the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_REMOVE, _("Remove Jobs"), _("Remove the selected GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CANCEL, _("&Cancel Jobs"), _("Cancel the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_PAUSE, _("&Pause Jobs\tCtrl+P"), _("Pause the selected GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_RESUME, _("&Resume Jobs\tCtrl+R"), _("Resume the selected paused GAMESS jobs"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEFOLDER, _("Save Output to Folder\tCtrl+S"), _("Save GAMESS output for selected jobs to a folder"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSave"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_SAVEAS, _("Save Output As..."), _("Save GAMESS output for this job"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("menu/wxSaveAs"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->Append(ID_MACMOLPLT, _("Open in wxMacMolPlt\tCtrl+O"), _T(""), wxITEM_NORMAL); jobsMenu->Append(ID_VIEWLOGS, _("View &Logs"), _("View the GAMESS log files for the selected jobs"), wxITEM_NORMAL); jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, ID_REFRESH, _("Refresh\tAlt-R"), _("Refresh the display of the queue status"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } jobsMenu->AppendSeparator(); { wxMenuItem* menuItem = new wxMenuItem(jobsMenu, wxID_CLEAR, _("Clean Up"), _("Clear all finished GAMESS jobs from the queue"), wxITEM_NORMAL); wxBitmap bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-16.png"))); menuItem->SetBitmap(bitmap); jobsMenu->Append(menuItem); } wxMenu* itemMenu24 = new wxMenu; itemMenu24->Append(wxID_ABOUT, _("&About"), _T(""), wxITEM_NORMAL); menuBar->Append(itemMenu24, _("&Help")); itemFrame1->SetMenuBar(menuBar); jobsToolbar = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL|wxTB_TEXT|wxTB_NODIVIDER, ID_TOOLBAR1 ); jobsToolbar->SetToolBitmapSize(wxSize(24, 24)); wxBitmap itemtool27Bitmap(itemFrame1->GetBitmapResource(wxT("icons/add-24.png"))); wxBitmap itemtool27BitmapDisabled; jobsToolbar->AddTool(wxID_ADD, _("Add"), itemtool27Bitmap, itemtool27BitmapDisabled, wxITEM_NORMAL, _T(""), _("Add a new GAMESS jobs to the end of the queue")); wxBitmap itemtool28Bitmap(itemFrame1->GetBitmapResource(wxT("icons/remove-24.png"))); wxBitmap itemtool28BitmapDisabled; jobsToolbar->AddTool(wxID_REMOVE, _("Remove"), itemtool28Bitmap, itemtool28BitmapDisabled, wxITEM_NORMAL, _T(""), _("Remove the selected GAMESS jobs from the queue")); jobsToolbar->AddSeparator(); wxBitmap itemtool30Bitmap(itemFrame1->GetBitmapResource(wxT("icons/cancel-24.png"))); wxBitmap itemtool30BitmapDisabled; jobsToolbar->AddTool(wxID_CANCEL, _("Cancel"), itemtool30Bitmap, itemtool30BitmapDisabled, wxITEM_NORMAL, _T(""), _("Cancel the selected GAMESS jobs")); wxBitmap itemtool31Bitmap(itemFrame1->GetBitmapResource(wxT("icons/pause-24.png"))); wxBitmap itemtool31BitmapDisabled; jobsToolbar->AddTool(ID_PAUSE, _("Pause"), itemtool31Bitmap, itemtool31BitmapDisabled, wxITEM_NORMAL, _T(""), _("Pause the selected GAMESS jobs")); wxBitmap itemtool32Bitmap(itemFrame1->GetBitmapResource(wxT("icons/resume-24.png"))); wxBitmap itemtool32BitmapDisabled; jobsToolbar->AddTool(ID_RESUME, _("Resume"), itemtool32Bitmap, itemtool32BitmapDisabled, wxITEM_NORMAL, _T(""), _("Resume the selected paused GAMESS jobs")); jobsToolbar->AddSeparator(); wxBitmap itemtool34Bitmap(itemFrame1->GetBitmapResource(wxT("icons/refresh-24.png"))); wxBitmap itemtool34BitmapDisabled; jobsToolbar->AddTool(ID_REFRESH, _("Refresh"), itemtool34Bitmap, itemtool34BitmapDisabled, wxITEM_NORMAL, _T(""), _("Refresh the display of the queue status")); jobsToolbar->AddSeparator(); wxBitmap itemtool36Bitmap(itemFrame1->GetBitmapResource(wxT("icons/clear-24.png"))); wxBitmap itemtool36BitmapDisabled; jobsToolbar->AddTool(wxID_CLEAR, _("Clean Up"), itemtool36Bitmap, itemtool36BitmapDisabled, wxITEM_NORMAL, _T(""), _("Clear all finished GAMESS jobs from the queue")); jobsToolbar->Realize(); itemFrame1->SetToolBar(jobsToolbar); wxBoxSizer* itemBoxSizer37 = new wxBoxSizer(wxVERTICAL); itemFrame1->SetSizer(itemBoxSizer37); jobListCtrl = new wxListCtrl( itemFrame1, ID_JOBLISTCTRL, wxDefaultPosition, wxSize(590, 300), wxLC_REPORT|wxLC_EDIT_LABELS|wxLC_HRULES|wxLC_VRULES|wxSUNKEN_BORDER ); itemBoxSizer37->Add(jobListCtrl, 1, wxGROW|wxALL, 0); wxStatusBar* itemStatusBar39 = new wxStatusBar( itemFrame1, ID_STATUSBAR1, wxNO_BORDER ); itemStatusBar39->SetFieldsCount(1); itemFrame1->SetStatusBar(itemStatusBar39); ////@end GamessQFrame content construction // create the dialog objects mConfigDialog = new ConfigurationDialog(this); mJobOptionsDialog = new JobOptionsDialog(this); // initiate the queue manager, if this fails, we're toast if (! mQueueManager.Init()) { wxLogFatalError(wxT("Failed to start the backend!")); } mActive = mQueueManager.IsActive(); AppMenu->Check(ID_PAUSEALL, ! mActive); // load settings mConfig = new wxConfig(WX_CONFIG_APPNAME); wxString stringFreq; long freq; if (mConfig->Read(wxT("Refresh Frequency"), &freq)) { mRefreshFrequency = freq; } else { mConfigDialog->SetRefreshFrequency(mRefreshFrequency / 1000); mConfigDialog->SetGamessPath(mQueueManager.GetGamessDir()); mConfigDialog->SetSpoolDir(mQueueManager.GetSpoolDir()); mConfigDialog->Show(); } // start the timer mRefreshTimer = new wxTimer(this, ID_TIMER); mRefreshTimer->Start(mRefreshFrequency, wxTIMER_ONE_SHOT); // set up the queue list jobListCtrl->InsertColumn(0, wxT("Name")); jobListCtrl->InsertColumn(1, wxT("Processors")); jobListCtrl->InsertColumn(2, wxT("Status")); jobListCtrl->SetColumnWidth(0, 400); jobListCtrl->SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER); jobListCtrl->SetColumnWidth(2, 80); RefreshList(); RefreshButtons(); SetDropTarget(new DropTarget(this)); }
/** * Constructor of the main frame. */ MainFrame::MainFrame( wxWindow* parent ) : projectCurrentlyEdited(0), ribbon(NULL), ribbonFileBt(NULL), ribbonSceneEditorButtonBar(NULL), buildToolsPnl(NULL), mainFrameWrapper(NULL, NULL, this, NULL, NULL, NULL, &scenesLockingShortcuts, wxGetCwd()), startPage(NULL), projectManager(NULL) { //(*Initialize(MainFrame) wxBoxSizer* ribbonSizer; wxMenuItem* MenuItem1; wxFlexGridSizer* FlexGridSizer2; wxMenuItem* MenuItem42; wxMenuItem* MenuItem41; wxFlexGridSizer* FlexGridSizer1; Create(parent, wxID_ANY, _("GDevelop"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY")); SetClientSize(wxSize(850,700)); { wxIcon FrameIcon; FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("res/icon16.png")))); SetIcon(FrameIcon); } FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableRow(1); ribbonSizer = new wxBoxSizer(wxVERTICAL); FlexGridSizer1->Add(ribbonSizer, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1")); FlexGridSizer2 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer2->AddGrowableCol(0); FlexGridSizer2->AddGrowableRow(0); editorsNotebook = new wxAuiNotebook(Panel1, ID_AUINOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_SPLIT|wxAUI_NB_TAB_MOVE|wxAUI_NB_SCROLL_BUTTONS|wxAUI_NB_TOP|wxNO_BORDER); FlexGridSizer2->Add(editorsNotebook, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); infoBar = new wxInfoBar(Panel1,ID_CUSTOM1); FlexGridSizer2->Add(infoBar, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); Panel1->SetSizer(FlexGridSizer2); FlexGridSizer2->Fit(Panel1); FlexGridSizer2->SetSizeHints(Panel1); FlexGridSizer1->Add(Panel1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); SetSizer(FlexGridSizer1); MenuItem1 = new wxMenuItem((&openContextMenu), ID_MENUITEM1, _("Open an example"), wxEmptyString, wxITEM_NORMAL); openContextMenu.Append(MenuItem1); MenuItem10 = new wxMenuItem((&saveContextMenu), ID_MENUITEM2, _("Save as..."), wxEmptyString, wxITEM_NORMAL); MenuItem10->SetBitmap(gd::SkinHelper::GetIcon("saveas", 16)); saveContextMenu.Append(MenuItem10); MenuItem41 = new wxMenuItem((&decomposerContextMenu), ID_MENUITEM4, _("Decompose an animated GIF"), wxEmptyString, wxITEM_NORMAL); MenuItem41->SetBitmap(wxBitmap(wxImage(_T("res/importgif.png")))); decomposerContextMenu.Append(MenuItem41); MenuItem42 = new wxMenuItem((&decomposerContextMenu), ID_MENUITEM5, _("Decompose a RPG Maker character"), wxEmptyString, wxITEM_NORMAL); MenuItem42->SetBitmap(wxBitmap(wxImage(_T("res/importrpgmaker.png")))); decomposerContextMenu.Append(MenuItem42); MenuItem43 = new wxMenuItem((&decomposerContextMenu), ID_MENUITEM6, _("Decompose a spritesheet"), wxEmptyString, wxITEM_NORMAL); MenuItem43->SetBitmap(wxBitmap(wxImage(_T("res/spritesheet16.png")))); decomposerContextMenu.Append(MenuItem43); autoSaveTimer.SetOwner(this, ID_TIMER1); autoSaveTimer.Start(180000, false); MenuItem2 = new wxMenuItem((&fileMenu), ID_MENUITEM7, _("New\tCtrl+N"), wxEmptyString, wxITEM_NORMAL); MenuItem2->SetBitmap(gd::SkinHelper::GetIcon("new", 16)); fileMenu.Append(MenuItem2); fileMenu.AppendSeparator(); MenuItem3 = new wxMenuItem((&fileMenu), ID_MENUITEM9, _("Open\tCtrl+O"), wxEmptyString, wxITEM_NORMAL); MenuItem3->SetBitmap(gd::SkinHelper::GetIcon("open", 16)); fileMenu.Append(MenuItem3); MenuItem4 = new wxMenuItem((&fileMenu), ID_MENUITEM10, _("Open an example"), wxEmptyString, wxITEM_NORMAL); fileMenu.Append(MenuItem4); menuRecentFiles = new wxMenu(); MenuItem23 = new wxMenuItem(menuRecentFiles, toBeDeletedMenuItem, _("useless"), wxEmptyString, wxITEM_NORMAL); menuRecentFiles->Append(MenuItem23); fileMenu.Append(ID_MENUITEM26, _("Recently opened"), menuRecentFiles, wxEmptyString); fileMenu.AppendSeparator(); MenuItem6 = new wxMenuItem((&fileMenu), ID_MENUITEM12, _("Save\tCtrl+S"), wxEmptyString, wxITEM_NORMAL); MenuItem6->SetBitmap(gd::SkinHelper::GetIcon("save", 16)); fileMenu.Append(MenuItem6); MenuItem7 = new wxMenuItem((&fileMenu), ID_MENUITEM13, _("Save as..."), wxEmptyString, wxITEM_NORMAL); MenuItem7->SetBitmap(gd::SkinHelper::GetIcon("saveas", 16)); fileMenu.Append(MenuItem7); MenuItem12 = new wxMenuItem((&fileMenu), ID_MENUITEM16, _("Save all\tCtrl+Shift+S"), wxEmptyString, wxITEM_NORMAL); MenuItem12->SetBitmap(gd::SkinHelper::GetIcon("save_all", 16)); fileMenu.Append(MenuItem12); fileMenu.AppendSeparator(); fileMenu.AppendSeparator(); MenuItem15 = new wxMenuItem((&fileMenu), ID_MENUITEM19, _("Close the current project"), wxEmptyString, wxITEM_NORMAL); MenuItem15->SetBitmap(gd::SkinHelper::GetIcon("close", 16)); fileMenu.Append(MenuItem15); fileMenu.AppendSeparator(); MenuItem13 = new wxMenuItem((&fileMenu), ID_MENUITEM17, _("Options"), wxEmptyString, wxITEM_NORMAL); MenuItem13->SetBitmap(gd::SkinHelper::GetIcon("options", 16)); fileMenu.Append(MenuItem13); fileMenu.AppendSeparator(); MenuItem22 = new wxMenuItem((&fileMenu), ID_MENUITEM27, _("Help\tF1"), wxEmptyString, wxITEM_NORMAL); MenuItem22->SetBitmap(gd::SkinHelper::GetIcon("help", 16)); fileMenu.Append(MenuItem22); fileMenu.AppendSeparator(); MenuItem8 = new wxMenuItem((&fileMenu), ID_MENUITEM14, _("Quit"), _("Quit GDevelop"), wxITEM_NORMAL); fileMenu.Append(MenuItem8); menuRecentFiles->Delete(toBeDeletedMenuItem); MenuItem16 = new wxMenuItem((&helpMenu), ID_MENUITEM20, _("Help"), wxEmptyString, wxITEM_NORMAL); MenuItem16->SetBitmap(gd::SkinHelper::GetIcon("help", 16)); helpMenu.Append(MenuItem16); MenuItem19 = new wxMenuItem((&helpMenu), ID_MENUITEM23, _("Tutorial"), wxEmptyString, wxITEM_NORMAL); helpMenu.Append(MenuItem19); helpMenu.AppendSeparator(); MenuItem21 = new wxMenuItem((&helpMenu), ID_MENUITEM25, _("Check for updates"), wxEmptyString, wxITEM_NORMAL); helpMenu.Append(MenuItem21); helpMenu.AppendSeparator(); MenuItem20 = new wxMenuItem((&helpMenu), ID_MENUITEM24, _("Official web site"), wxEmptyString, wxITEM_NORMAL); MenuItem20->SetBitmap(gd::SkinHelper::GetIcon("site", 16)); helpMenu.Append(MenuItem20); MenuItem17 = new wxMenuItem((&helpMenu), ID_MENUITEM21, _("About..."), wxEmptyString, wxITEM_NORMAL); MenuItem17->SetBitmap(wxBitmap(wxImage(_T("res/icon16.png")))); helpMenu.Append(MenuItem17); MenuItem11 = new wxMenuItem((&disabledFileMenu), ID_MENUITEM3, _("Please stop the preview before continuing"), wxEmptyString, wxITEM_NORMAL); disabledFileMenu.Append(MenuItem11); MenuItem11->Enable(false); SetSizer(FlexGridSizer1); Layout(); Center(); Connect(ID_AUINOTEBOOK1,wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE,(wxObjectEventFunction)&MainFrame::OneditorsNotebookPageClose); Connect(ID_AUINOTEBOOK1,wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&MainFrame::OnNotebook1PageChanged); Connect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnOpenExampleSelected); Connect(ID_MENUITEM2,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuSaveAsSelected); Connect(ID_MENUITEM4,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnDecomposeGIFSelected); Connect(ID_MENUITEM5,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnDecomposeRPGSelected); Connect(ID_MENUITEM6,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnDecomposeSSSelected); Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&MainFrame::OnautoSaveTimerTrigger); Connect(ID_MENUITEM7,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuNewSelected); Connect(ID_MENUITEM9,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuOpenSelected); Connect(ID_MENUITEM10,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnOpenExampleSelected); Connect(ID_MENUITEM12,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuSaveSelected); Connect(ID_MENUITEM13,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuSaveAsSelected); Connect(ID_MENUITEM16,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuSaveAllSelected); Connect(ID_MENUITEM19,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnCloseCurrentProjectSelected); Connect(ID_MENUITEM17,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuPrefSelected); Connect(ID_MENUITEM27,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuAideSelected); Connect(ID_MENUITEM14,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnQuit); Connect(ID_MENUITEM20,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuAideSelected); Connect(ID_MENUITEM23,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuTutoSelected); Connect(ID_MENUITEM25,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuItem36Selected); Connect(ID_MENUITEM24,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnMenuSiteSelected); Connect(ID_MENUITEM21,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&MainFrame::OnAbout); Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&MainFrame::OnClose); Connect(wxEVT_SIZE,(wxObjectEventFunction)&MainFrame::OnResize); //*) Connect( wxID_FILE1, wxID_FILE9, wxEVT_COMMAND_MENU_SELECTED, ( wxObjectEventFunction )&MainFrame::OnRecentClicked ); Connect( idRibbonNew, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuNewSelected ); Connect( idRibbonOpen, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuOpenSelected ); Connect( idRibbonOpen, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, ( wxObjectEventFunction )&MainFrame::OnRibbonOpenDropDownClicked ); Connect( idRibbonSave, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuSaveSelected ); Connect( idRibbonSave, wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, ( wxObjectEventFunction )&MainFrame::OnRibbonSaveDropDownClicked ); Connect( idRibbonSaveAll, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnRibbonSaveAllClicked ); Connect( idRibbonOptions, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuPrefSelected ); Connect( idRibbonHelp, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuAideSelected ); Connect( idRibbonTuto, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuTutoSelected ); Connect( idRibbonForum, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuForumSelected ); Connect( idRibbonUpdate, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuItem36Selected ); Connect( idRibbonWebSite, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnMenuSiteSelected ); Connect( idRibbonCredits, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, ( wxObjectEventFunction )&MainFrame::OnAbout ); Connect( ID_RIBBON, wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING, ( wxObjectEventFunction )&MainFrame::OnRibbonPageChanging ); Connect( ID_RIBBON, wxEVT_COMMAND_RIBBONBAR_HELP_CLICKED, ( wxObjectEventFunction )&MainFrame::OnRibbonHelpBtClick ); Connect( ID_RIBBON, wxEVT_COMMAND_RIBBONBAR_TOGGLED, ( wxObjectEventFunction )&MainFrame::OnRibbonToggleBtClick ); #ifdef GD_NO_UPDATE_CHECKER //Remove the menu item to check for updates helpMenu.Delete(MenuItem21); //(useful when GD is distributed on a system managing updates by itself). #endif //Update the file menu with exporting items for (unsigned int i = 0;i<gd::PlatformManager::Get()->GetAllPlatforms().size();++i) { std::shared_ptr<gd::ProjectExporter> exporter = gd::PlatformManager::Get()->GetAllPlatforms()[i]->GetProjectExporter(); if ( exporter != std::shared_ptr<gd::ProjectExporter>() && !exporter->GetProjectExportButtonLabel().empty() ) { long id = wxNewId(); fileMenu.Insert(10, id, exporter->GetProjectExportButtonLabel()); Connect( id, wxEVT_COMMAND_MENU_SELECTED, ( wxObjectEventFunction )&MainFrame::OnMenuCompilationSelected ); idToPlatformExportMenuMap[id] = gd::PlatformManager::Get()->GetAllPlatforms()[i].get(); } } wxIconBundle icons; icons.AddIcon("res/icon16.png"); icons.AddIcon("res/icon24.png"); #if defined(LINUX) || defined(MACOS) icons.AddIcon("res/icon32linux.png"); icons.AddIcon("res/icon48linux.png"); icons.AddIcon("res/icon64linux.png"); icons.AddIcon("res/icon128linux.png"); #else icons.AddIcon("res/icon32.png"); icons.AddIcon("res/icon48.png"); icons.AddIcon("res/icon128.png"); #endif SetIcons(icons); SetDropTarget(new DnDFileEditor(*this)); //Set the content scale factor, for "retina" screens support. gd::GUIContentScaleFactor::Set(GetContentScaleFactor()); wxConfigBase *pConfig = wxConfigBase::Get(); //Deactivate menu SetMenuBar(NULL); //Prepare autosave PrepareAutosave(); //Prepare recent list m_recentlist.SetMaxEntries( 9 ); m_recentlist.SetAssociatedMenu( menuRecentFiles ); for ( int i = 0;i < 9;i++ ) { wxString result; pConfig->Read( wxString::Format( _T( "/Recent/%d" ), i ), &result ); m_recentlist.Append( result ); } //Create status bar wxStatusBar * statusBar = new wxStatusBar(this); static int widths[2] = { -1, 175 }; statusBar->SetFieldsCount(2); statusBar->SetStatusWidths(2, widths); statusBar->SetStatusText( "2008-2014", 1 ); SetStatusBar(statusBar); std::vector<wxWindow*> controlsToBeDisabledOnPreview; //Used below: //Ribbon setup long ribbonStyle = wxRIBBON_BAR_DEFAULT_STYLE; bool hidePageTabs = false; pConfig->Read( _T( "/Skin/HidePageTabs" ), &hidePageTabs ); if ( hidePageTabs ) { ribbonStyle &= ~wxRIBBON_BAR_SHOW_PAGE_LABELS; } ribbon = new wxRibbonBar(this, ID_RIBBON); ribbon->SetWindowStyle(ribbonStyle); bool hideLabels = false; pConfig->Read( _T( "/Skin/HideLabels" ), &hideLabels ); { wxRibbonPage * ribbonProjectPage = new wxRibbonPage(ribbon, wxID_ANY, _("Projects")); ProjectManager::CreateRibbonPage(ribbonProjectPage); } { wxRibbonPage * ribbonEditorPage = new wxRibbonPage(ribbon, wxID_ANY, _("Images bank")); // { wxRibbonPanel *ribbonPanel = new wxRibbonPanel(ribbonEditorPage, wxID_ANY, _("Adding resources"), gd::SkinHelper::GetRibbonIcon("list"), wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE); wxRibbonButtonBar *ribbonBar = new wxRibbonButtonBar(ribbonPanel, wxID_ANY); ribbonBar->AddButton(ResourcesEditor::idRibbonAdd, !hideLabels ? _("Add an image") : "", gd::SkinHelper::GetRibbonIcon("add"), _("Add an image to the resources")); ribbonBar->AddButton(ResourcesEditor::idRibbonAddFromLibrary, !hideLabels ? _("Add from the library") : "", gd::SkinHelper::GetRibbonIcon("addFromLibrary"), _("Add an image from a library of images")); ribbonBar->AddButton(ResourcesEditor::idRibbonAddDossier, !hideLabels ? _("Add a virtual folder") : "", gd::SkinHelper::GetRibbonIcon("virtualfolderadd"), _("Add a virtual folder to organize resources")); controlsToBeDisabledOnPreview.push_back(ribbonBar); } { wxRibbonPanel *ribbonPanel = new wxRibbonPanel(ribbonEditorPage, wxID_ANY, _("List management"), gd::SkinHelper::GetRibbonIcon("list"), wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE); wxRibbonButtonBar *ribbonBar = new wxRibbonButtonBar(ribbonPanel, wxID_ANY); ribbonBar->AddButton(ResourcesEditor::idRibbonDel, !hideLabels ? _("Delete") : "", gd::SkinHelper::GetRibbonIcon("delete"), _("Delete the selected resource")); ribbonBar->AddButton(ResourcesEditor::idRibbonDeleteUnused, !hideLabels ? _("Remove useless resources") : "", gd::SkinHelper::GetRibbonIcon("deleteunknown"), _("Check if there are useless resources that can be removed")); ribbonBar->AddButton(ResourcesEditor::idRibbonUp, !hideLabels ? _("Move up") : "", gd::SkinHelper::GetRibbonIcon("up")); ribbonBar->AddButton(ResourcesEditor::idRibbonDown, !hideLabels ? _("Move down") : "", gd::SkinHelper::GetRibbonIcon("down")); ribbonBar->AddButton(ResourcesEditor::idRibbonRefresh, !hideLabels ? _("Refresh") : "", gd::SkinHelper::GetRibbonIcon("refresh"), _("Refresh the list, if you've done changes in another window")); controlsToBeDisabledOnPreview.push_back(ribbonBar); } { wxRibbonPanel *ribbonPanel = new wxRibbonPanel(ribbonEditorPage, wxID_ANY, _("View"), gd::SkinHelper::GetRibbonIcon("edit"), wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE); wxRibbonButtonBar *ribbonBar = new wxRibbonButtonBar(ribbonPanel, wxID_ANY); ribbonBar->AddButton(ResourcesEditor::idRibbonShowPreview, !hideLabels ? _("Preview") : "", gd::SkinHelper::GetRibbonIcon("view"), _("Show a panel with the image displayed inside")); ribbonBar->AddButton(ResourcesEditor::idRibbonShowPropertyGrid, !hideLabels ? _("Properties") : "", gd::SkinHelper::GetRibbonIcon("editprop"), _("Show the properties of the resource")); controlsToBeDisabledOnPreview.push_back(ribbonBar); } { wxRibbonPanel *ribbonPanel = new wxRibbonPanel(ribbonEditorPage, wxID_ANY, _("Help"), gd::SkinHelper::GetRibbonIcon("help"), wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_DEFAULT_STYLE); wxRibbonButtonBar *ribbonBar = new wxRibbonButtonBar(ribbonPanel, wxID_ANY); ribbonBar->AddButton(ResourcesEditor::idRibbonHelp, !hideLabels ? _("Help") : "", gd::SkinHelper::GetRibbonIcon("help"), _("Open the online help")); controlsToBeDisabledOnPreview.push_back(ribbonBar); } } { wxRibbonPage * ribbonEditorPage = new wxRibbonPage(ribbon, wxID_ANY, _("Scene")); ribbonSceneEditorButtonBar = gd::LayoutEditorCanvas::CreateRibbonPage(ribbonEditorPage); } { wxRibbonPage * ribbonEditorPage = new wxRibbonPage(ribbon, wxID_ANY, _("Events")); EventsEditor::CreateRibbonPage(ribbonEditorPage); } { wxRibbonPage * ribbonEditorPage = new wxRibbonPage(ribbon, wxID_ANY, _("Objects")); gd::ObjectsEditor::CreateRibbonPage(ribbonEditorPage); } { wxRibbonPage * ribbonEditorPage = new wxRibbonPage(ribbon, wxID_ANY, _("Code")); CodeEditor::CreateRibbonPage(ribbonEditorPage); } ribbon->Realize(); ribbonSizer->Add(ribbon, 0, wxEXPAND); //Create ribbon "File" custom button ribbonFileBt = new wxStaticBitmap(ribbon, idRibbonFileBt, wxNullBitmap); ribbonFileBt->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(MainFrame::OnRibbonFileBtLeave), NULL, this); ribbonFileBt->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(MainFrame::OnRibbonFileBtEnter), NULL, this); ribbonFileBt->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(MainFrame::OnRibbonFileBtClick), NULL, this); //Load wxAUI m_mgr.SetManagedWindow( this ); gd::SkinHelper::ApplyCurrentSkin(m_mgr); gd::SkinHelper::ApplyCurrentSkin(*editorsNotebook); gd::SkinHelper::ApplyCurrentSkin(*ribbon); RealizeRibbonCustomButtons(); //Create start page startPage = new StartHerePage(editorsNotebook, *this); editorsNotebook->AddPage(startPage, _("Start page")); //Create project manager projectManager = new ProjectManager(this, *this); projectManager->ConnectEvents(); //Create project properties panel projectPropertiesPnl = new ProjectPropertiesPnl(this); //Create build tools panel buildToolsPnl = new BuildToolsPnl(this, projectManager); //Setup panes and load user configuration m_mgr.AddPane( projectManager, wxAuiPaneInfo().Name( wxT( "PM" ) ).Caption( _( "Project manager" ) ).Left().MaximizeButton( true ).MinimizeButton( false ).MinSize(170,100) ); m_mgr.AddPane( Panel1, wxAuiPaneInfo().Name( wxT( "EP" ) ).Caption( _( "Main editor" ) ).Center().CaptionVisible(false).CloseButton( false ).MaximizeButton( true ).MinimizeButton( false ) ); m_mgr.AddPane( ribbon, wxAuiPaneInfo().Name( wxT( "RP" ) ).Caption( _( "Ribbon" ) ).Top().PaneBorder(false).CaptionVisible(false).Movable(false).Floatable(false).CloseButton( false ).MaximizeButton( false ).MinimizeButton( false ).Resizable(false) ); m_mgr.AddPane( buildToolsPnl, wxAuiPaneInfo().Name( wxT( "CT" ) ).Caption( _( "Compilation tools" ) ).Bottom().MaximizeButton( true ).MinimizeButton( false ).Show(false).MinSize(120,130)); m_mgr.AddPane( projectPropertiesPnl, wxAuiPaneInfo().Name( wxT( "PP" ) ).Caption( _( "Project properties" ) ).Float().Show(false) ); wxString result; pConfig->Read( _T( "/Workspace/Actuel" ), &result ); if ( result != "" ) m_mgr.LoadPerspective( result , true ); //Ensure that names are corrected ( Useful in particular to ensure that these name are in the selected language ). m_mgr.GetPane(projectManager).Caption(_( "Project manager" )); m_mgr.GetPane(buildToolsPnl).Caption(_( "Compilation tools" )); m_mgr.GetPane(projectPropertiesPnl).Caption(_( "Project properties" )); //Change ribbon pane height. bool hidePanels = false; pConfig->Read( _T( "/Skin/HidePanels" ), &hidePanels ); ribbon->ShowPanels(!hidePanels); m_mgr.GetPane(ribbon).MinSize(1, ribbon->GetBestSize().GetHeight()+4); m_mgr.SetFlags( wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_ALLOW_ACTIVE_PANE | wxAUI_MGR_TRANSPARENT_HINT | wxAUI_MGR_TRANSPARENT_DRAG | wxAUI_MGR_HINT_FADE | wxAUI_MGR_NO_VENETIAN_BLINDS_FADE ); m_mgr.Update(); UpdateNotebook(); infoBar->SetShowHideEffects(wxSHOW_EFFECT_SLIDE_TO_BOTTOM, wxSHOW_EFFECT_BLEND); //Construct the lightweight wrapper used by editors to access to the main frame. mainFrameWrapper = gd::MainFrameWrapper(ribbon, ribbonSceneEditorButtonBar, this, &m_mgr, editorsNotebook, infoBar, &scenesLockingShortcuts, wxGetCwd()); mainFrameWrapper.AddControlToBeDisabledOnPreview(projectManager); for (unsigned int i = 0;i<controlsToBeDisabledOnPreview.size();++i) mainFrameWrapper.AddControlToBeDisabledOnPreview(controlsToBeDisabledOnPreview[i]); SetSize(900,740); Center(); Maximize(true); }
//--------------------------------------------------------- CSAGA_Frame::CSAGA_Frame(void) : wxMDIParentFrame(NULL, ID_WND_MAIN, SAGA_CAPTION, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE|wxHSCROLL|wxVSCROLL|wxFRAME_NO_WINDOW_MENU) { //----------------------------------------------------- g_pSAGA_Frame = this; m_nTopWindows = 0; m_pTopWindows = NULL; m_pINFO = NULL; m_pData_Source = NULL; m_pActive = NULL; m_pWKSP = NULL; SG_Set_UI_Callback (Get_Callback()); SetIcon (IMG_Get_Icon(ID_IMG_SAGA_ICON_32)); SetDropTarget (new CSAGA_Frame_DropTarget); //----------------------------------------------------- int STATUSBAR_Sizes[STATUSBAR_COUNT] = { -1, -1, 90, 90, 90, -1 }; CreateStatusBar (STATUSBAR_COUNT); SetStatusWidths (STATUSBAR_COUNT, STATUSBAR_Sizes); SetStatusBarPane (STATUSBAR_DEFAULT); StatusBar_Set_Text (_TL("ready")); m_pProgressBar = ((CSAGA_Frame_StatusBar *)GetStatusBar())->m_pProgressBar; //----------------------------------------------------- m_pLayout = new wxAuiManager(this); m_pLayout->GetArtProvider()->SetColor (wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR, wxSystemSettings::GetColour(wxSYS_COLOUR_ACTIVECAPTION) ); m_pLayout->GetArtProvider()->SetColor (wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR, wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) ); m_pLayout->GetArtProvider()->SetMetric (wxAUI_DOCKART_GRADIENT_TYPE , wxAUI_GRADIENT_NONE); m_pLayout->GetArtProvider()->SetMetric (wxAUI_DOCKART_CAPTION_SIZE , 14); m_pLayout->SetFlags(m_pLayout->GetFlags() ^ wxAUI_MGR_TRANSPARENT_DRAG); // m_pLayout->SetFlags(m_pLayout->GetFlags() ^ wxAUI_MGR_ALLOW_ACTIVE_PANE); //----------------------------------------------------- _Bar_Add(m_pINFO = new CINFO (this), 0, 0); m_pINFO ->Add_Pages(); _Bar_Add(m_pWKSP = new CWKSP (this), 2, 1); m_pWKSP ->Add_Pages(); _Bar_Add(m_pData_Source = new CData_Source(this), 2, 1); m_pData_Source ->Add_Pages(); _Bar_Add(m_pActive = new CACTIVE (this), 2, 0); m_pActive ->Add_Pages(); //----------------------------------------------------- _Create_MenuBar(); //----------------------------------------------------- m_pTB_Main = _Create_ToolBar(); m_pTB_Map = CVIEW_Map ::_Create_ToolBar(); m_pTB_Map_3D = CVIEW_Map_3D ::_Create_ToolBar(); m_pTB_Layout = CVIEW_Layout ::_Create_ToolBar(); m_pTB_Table = CVIEW_Table ::_Create_ToolBar(); m_pTB_Diagram = CVIEW_Table_Diagram ::_Create_ToolBar(); m_pTB_Histogram = CVIEW_Histogram ::_Create_ToolBar(); m_pTB_ScatterPlot = CVIEW_ScatterPlot ::_Create_ToolBar(); //----------------------------------------------------- m_pLayout->GetPane(GetClientWindow()).Show().Center(); wxString s; if( CONFIG_Read(wxT("/FL"), wxT("MANAGER"), s) ) { m_pLayout->LoadPerspective(s); } _Bar_Show(m_pTB_Main, true); //----------------------------------------------------- m_pLayout->Update(); #if !defined(_SAGA_LINUX) Show(true); #endif int x, y, dx, dy; long l; x = CONFIG_Read(wxT("/FL"), wxT("X" ), l) ? l : -1; y = CONFIG_Read(wxT("/FL"), wxT("Y" ), l) ? l : -1; dx = CONFIG_Read(wxT("/FL"), wxT("DX"), l) ? l : 800; dy = CONFIG_Read(wxT("/FL"), wxT("DY"), l) ? l : 600; SetSize(x, y, dx, dy); if( !(CONFIG_Read(wxT("/FL"), wxT("STATE"), l) && l == 0) ) { Maximize(); } #if defined(_SAGA_LINUX) Show(true); #endif Update(); //----------------------------------------------------- if( g_pSAGA->argc <= 1 && g_pData->Initialise() ) { Refresh(false); } ProgressBar_Set_Position(0); }
StatDialog::StatDialog(wxWindow *parent, wxString prefix, DatabaseManager *db, ConfigManager *cfg, RemarksHandler *rh, TimeInfo time, DrawInfoList user_draws) : szFrame(parent, wxID_ANY, _("Statistics window"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL), DBInquirer(db), m_period(time.period), m_start_time(time.begin_time), m_current_time(time.begin_time), m_end_time(time.end_time), m_tofetch(0) { SetHelpText(_T("draw3-ext-meanvalues")); cfg->RegisterConfigObserver(this); wxPanel* panel = new wxPanel(this); wxString period_choices[PERIOD_T_SEASON] = { _("DECADE"), _("YEAR"), _("MONTH"), _("WEEK"), _("DAY"), _("30 MINUTES") }; wxStaticText *label; wxStaticLine *line; wxButton *button; m_config_manager = cfg; m_database_manager = db; m_draw_search = new IncSearch(m_config_manager, rh, prefix, this, wxID_ANY, _("Choose draw"), false, true, true, m_database_manager); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); label = new wxStaticText(panel, wxID_ANY, wxString(_T(" ")) + _("Choose graph parameters") + _T(": ")); sizer->Add(label, 0, wxALIGN_CENTER | wxALL, 5); wxStaticBoxSizer *sizer_1 = new wxStaticBoxSizer(wxVERTICAL, panel, wxString(_T(" ")) + _("Draw") + _T(": ")); button = new wxButton(panel, STAT_DRAW_BUTTON, _("Change draw")); sizer_1->Add(button, 1, wxEXPAND); sizer->Add(sizer_1, 0, wxEXPAND | wxALL, 5); wxStaticBoxSizer *sizer_2 = new wxStaticBoxSizer(wxVERTICAL, panel, wxString(_T(" ")) + _("Time range") + _T(": ")); wxFlexGridSizer* sizer_2_1 = new wxFlexGridSizer(2, 5, 5); sizer_2_1->AddGrowableCol(1); label = new wxStaticText(panel, wxID_ANY, _("Start time:")); sizer_2_1->Add(label, 0, wxALIGN_CENTER | wxALL, 5); button = new wxButton(panel, STAT_START_TIME, FormatTime(m_start_time.GetTime(), m_period)); button->SetFocus(); sizer_2_1->Add(button, 1, wxEXPAND); label = new wxStaticText(panel, wxID_ANY, _("End time:")); sizer_2_1->Add(label, 0, wxALIGN_CENTER | wxALL, 5); button = new wxButton(panel, STAT_END_TIME, FormatTime(m_end_time.GetTime(), m_period)); sizer_2_1->Add(button, 1, wxEXPAND); sizer_2->Add(sizer_2_1, 0, wxEXPAND | wxALL, 5); sizer->Add(sizer_2, 0, wxEXPAND | wxALL, 5); line = new wxStaticLine(panel); sizer->Add(line, 0, wxEXPAND, 5); wxStaticBoxSizer* sizer_3 = new wxStaticBoxSizer(wxVERTICAL, panel, wxString(_T(" ")) + _("Period") + _T(": ")); line = new wxStaticLine(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL); m_period_choice = new wxChoice(panel, STAT_CHOICE_PERIOD, wxDefaultPosition, wxDefaultSize, PERIOD_T_SEASON, period_choices); sizer_3->Add(m_period_choice, 0, wxALIGN_CENTER | wxALL, 5); sizer->Add(sizer_3, 0, wxEXPAND | wxALL, 5); wxStaticBoxSizer* sizer_4 = new wxStaticBoxSizer(wxVERTICAL, panel, wxString(_T(" ")) + _("Values") + _T(": ")); wxPanel *subpanel = new wxPanel(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); wxFlexGridSizer *subpanel_sizer = new wxFlexGridSizer(2, 5, 5); subpanel_sizer->AddGrowableCol(2); label = new wxStaticText(subpanel, wxID_ANY, wxString(_("Minimum value")) + _T(":")); subpanel_sizer->Add(label, wxALIGN_LEFT | wxALL, 10); m_min_value_text = new wxStaticText(subpanel, wxID_ANY, _T("")); subpanel_sizer->Add(m_min_value_text, wxEXPAND | wxALL, 10); label = new wxStaticText(subpanel, wxID_ANY, wxString(_("Average value")) + _T(":")); subpanel_sizer->Add(label, wxALIGN_LEFT | wxLEFT | wxRIGHT, 20); m_avg_value_text = new wxStaticText(subpanel, wxID_ANY, _T("")); subpanel_sizer->Add(m_avg_value_text, wxEXPAND | wxLEFT | wxRIGHT, 20); label = new wxStaticText(subpanel, wxID_ANY, wxString(_("Standard deviation")) + _T(":")); subpanel_sizer->Add(label, wxALIGN_LEFT | wxLEFT | wxRIGHT, 20); m_stddev_value_text = new wxStaticText(subpanel, wxID_ANY, _T("")); subpanel_sizer->Add(m_stddev_value_text, wxEXPAND | wxLEFT | wxRIGHT, 20); label = new wxStaticText(subpanel, wxID_ANY, wxString(_("Maximum value")) + _T(":")); subpanel_sizer->Add(label, wxALIGN_LEFT | wxLEFT | wxRIGHT, 20); m_max_value_text = new wxStaticText(subpanel, wxID_ANY, _T("")); subpanel_sizer->Add(m_max_value_text, wxEXPAND | wxLEFT | wxRIGHT, 20); label = new wxStaticText(subpanel, wxID_ANY, wxString(_("Hour sum")) + _T(":")); subpanel_sizer->Add(label, wxALIGN_LEFT | wxLEFT | wxRIGHT, 20); m_hsum_value_text = new wxStaticText(subpanel, wxID_ANY, _T("")); subpanel_sizer->Add(m_hsum_value_text, wxEXPAND | wxLEFT | wxRIGHT, 20); subpanel->SetSizer(subpanel_sizer); sizer_4->Add(subpanel, 0, wxEXPAND, 0); sizer->Add(sizer_4, 0, wxEXPAND | wxALL, 10); wxBoxSizer *sizer_5 = new wxBoxSizer(wxHORIZONTAL); button = new wxButton(panel, wxID_OK, _("OK")); button->SetDefault(); sizer_5->Add(button, 0, wxALL, 10); button = new wxButton(panel, wxID_CLOSE , _("Close")); sizer_5->Add(button, 0, wxALL, 10); button = new wxButton(panel, wxID_HELP, _("Help")); sizer_5->Add(button, 0, wxALL, 10); sizer->Add(sizer_5, 1, wxALIGN_CENTER | wxALL, 10); panel->SetSizer(sizer); wxSizer *ws = new wxBoxSizer(wxHORIZONTAL); ws->Add(panel, 1, wxEXPAND); SetSizer(ws); ws->SetSizeHints(this); SetDrawInfo( user_draws.GetSelectedDraw() ); // use enum position m_period_choice->SetSelection(time.period); DrawInfoDropTarget* dt = new DrawInfoDropTarget(this); SetDropTarget(dt); Show(true); }
// ------------------------------------------------------------------------ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE & ~(wxMAXIMIZE_BOX | wxRESIZE_BORDER) ) , m_statusbar( *CreateStatusBar(2, 0) ) , m_background( this, wxID_ANY, wxGetApp().GetLogoBitmap() ) // All menu components must be created on the heap! , m_menubar( *new wxMenuBar() ) , m_menuCDVD ( *new wxMenu() ) , m_menuSys ( *new wxMenu() ) , m_menuConfig ( *new wxMenu() ) , m_menuMisc ( *new wxMenu() ) , m_menuDebug ( *new wxMenu() ) , m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01, MenuId_State_LoadBackup ) ) , m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) ) , m_MenuItem_Console( *new wxMenuItem( &m_menuMisc, MenuId_Console, _("Show Console"), wxEmptyString, wxITEM_CHECK ) ) , m_MenuItem_Console_Stdio( *new wxMenuItem( &m_menuMisc, MenuId_Console_Stdio, _("Console to Stdio"), wxEmptyString, wxITEM_CHECK ) ) { m_RestartEmuOnDelete = false; for( int i=0; i<PluginId_Count; ++i ) m_PluginMenuPacks[i].Populate( (PluginsEnum_t)i ); // ------------------------------------------------------------------------ // Initial menubar setup. This needs to be done first so that the menu bar's visible size // can be factored into the window size (which ends up being background+status+menus) //m_menubar.Append( &m_menuBoot, _("&Boot") ); m_menubar.Append( &m_menuSys, _("&System") ); m_menubar.Append( &m_menuCDVD, _("CD&VD") ); m_menubar.Append( &m_menuConfig, _("&Config") ); m_menubar.Append( &m_menuMisc, _("&Misc") ); #ifdef PCSX2_DEVBUILD m_menubar.Append( &m_menuDebug, _("&Debug") ); #endif SetMenuBar( &m_menubar ); // ------------------------------------------------------------------------ wxSize backsize( m_background.GetSize() ); wxString wintitle; if( PCSX2_isReleaseVersion ) { // stable releases, with a simple title. wintitle.Printf( _("%s %d.%d.%d %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_MODS ? _("(modded)") : wxEmptyString ); } else { // beta / development editions, which feature revision number and compile date. wintitle.Printf( _("%s %d.%d.%d.%d%s (svn) %s"), pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString, fromUTF8(__DATE__).c_str() ); } SetTitle( wintitle ); // Ideally the __WXMSW__ port should use the embedded IDI_ICON2 icon, because wxWidgets sucks and // loses the transparency information when loading bitmaps into icons. But for some reason // I cannot get it to work despite following various examples to the letter. SetIcons( wxGetApp().GetIconBundle() ); int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) }; m_statusbar.SetStatusWidths(2, m_statusbar_widths); //m_statusbar.SetStatusText( L"The Status is Good!", 0); m_statusbar.SetStatusText( wxEmptyString, 0); wxBoxSizer& joe( *new wxBoxSizer( wxVERTICAL ) ); joe.Add( &m_background ); SetSizerAndFit( &joe ); // Use default window position if the configured windowpos is invalid (partially offscreen) if( g_Conf->MainGuiPosition == wxDefaultPosition || !pxIsValidWindowPosition( *this, g_Conf->MainGuiPosition) ) g_Conf->MainGuiPosition = GetScreenPosition(); else SetPosition( g_Conf->MainGuiPosition ); // Updating console log positions after the main window has been fitted to its sizer ensures // proper docked positioning, since the main window's size is invalid until after the sizer // has been set/fit. InitLogBoxPosition( g_Conf->ProgLogBox ); // ------------------------------------------------------------------------ // Some of the items in the System menu are configured by the UpdateCoreStatus() method. m_menuSys.Append(MenuId_Boot_CDVD, _("Initializing...")); m_menuSys.Append(MenuId_Boot_CDVD2, _("Initializing...")); m_menuSys.Append(MenuId_Boot_ELF, _("Run ELF..."), _("For running raw PS2 binaries directly")); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_SuspendResume, _("Initializing...")); m_menuSys.AppendSeparator(); //m_menuSys.Append(MenuId_Sys_Close, _("Close"), // _("Stops emulation and closes the GS window.")); m_menuSys.Append(MenuId_Sys_LoadStates, _("Load state"), &m_LoadStatesSubmenu); m_menuSys.Append(MenuId_Sys_SaveStates, _("Save state"), &m_SaveStatesSubmenu); m_menuSys.Append(MenuId_EnableBackupStates, _("Backup before save"), wxEmptyString, wxITEM_CHECK); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_EnablePatches, _("Automatic Gamefixes"), _("Automatically applies needed Gamefixes to known problematic games"), wxITEM_CHECK); m_menuSys.Append(MenuId_EnableCheats, _("Enable Cheats"), wxEmptyString, wxITEM_CHECK); m_menuSys.Append(MenuId_EnableWideScreenPatches, _("Enable Widescreen Patches"), wxEmptyString, wxITEM_CHECK); m_menuSys.Append(MenuId_EnableHostFs, _("Enable Host Filesystem"), wxEmptyString, wxITEM_CHECK); m_menuSys.AppendSeparator(); m_menuSys.Append(MenuId_Sys_Shutdown, _("Shutdown"), _("Wipes all internal VM states and shuts down plugins.")); m_menuSys.Append(MenuId_Exit, _("Exit"), AddAppName(_("Closing %s may be hazardous to your health"))); // ------------------------------------------------------------------------ wxMenu& isoRecents( wxGetApp().GetRecentIsoMenu() ); //m_menuCDVD.AppendSeparator(); m_menuCDVD.Append( MenuId_IsoSelector, _("Iso Selector"), &isoRecents ); m_menuCDVD.Append( GetPluginMenuId_Settings(PluginId_CDVD), _("Plugin Menu"), m_PluginMenuPacks[PluginId_CDVD] ); m_menuCDVD.AppendSeparator(); m_menuCDVD.Append( MenuId_Src_Iso, _("Iso"), _("Makes the specified ISO image the CDVD source."), wxITEM_RADIO ); m_menuCDVD.Append( MenuId_Src_Plugin, _("Plugin"), _("Uses an external plugin as the CDVD source."), wxITEM_RADIO ); m_menuCDVD.Append( MenuId_Src_NoDisc, _("No disc"), _("Use this to boot into your virtual PS2's BIOS configuration."), wxITEM_RADIO ); //m_menuCDVD.AppendSeparator(); //m_menuCDVD.Append( MenuId_SkipBiosToggle,_("Enable BOOT2 injection"), // _("Skips PS2 splash screens when booting from Iso or DVD media"), wxITEM_CHECK ); // ------------------------------------------------------------------------ m_menuConfig.Append(MenuId_Config_SysSettings, _("Emulation &Settings") ); m_menuConfig.Append(MenuId_Config_McdSettings, _("&Memory cards") ); m_menuConfig.Append(MenuId_Config_BIOS, _("&Plugin/BIOS Selector") ); if (IsDebugBuild) m_menuConfig.Append(MenuId_Config_GameDatabase, _("Game Database Editor") ); // Empty menu // m_menuConfig.Append(MenuId_Config_Language, _("Appearance...") ); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_GS, _("&Video (GS)"), m_PluginMenuPacks[PluginId_GS]); m_menuConfig.Append(MenuId_Config_SPU2, _("&Audio (SPU2)"), m_PluginMenuPacks[PluginId_SPU2]); m_menuConfig.Append(MenuId_Config_PAD, _("&Controllers (PAD)"),m_PluginMenuPacks[PluginId_PAD]); m_menuConfig.Append(MenuId_Config_DEV9, _("Dev9"), m_PluginMenuPacks[PluginId_DEV9]); m_menuConfig.Append(MenuId_Config_USB, _("USB"), m_PluginMenuPacks[PluginId_USB]); m_menuConfig.Append(MenuId_Config_FireWire, _("Firewire"), m_PluginMenuPacks[PluginId_FW]); //m_menuConfig.AppendSeparator(); //m_menuConfig.Append(MenuId_Config_Patches, _("Patches (unimplemented)"), wxEmptyString); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_Multitap0Toggle, _("Multitap 1"), wxEmptyString, wxITEM_CHECK ); m_menuConfig.Append(MenuId_Config_Multitap1Toggle, _("Multitap 2"), wxEmptyString, wxITEM_CHECK ); m_menuConfig.AppendSeparator(); m_menuConfig.Append(MenuId_Config_ResetAll, _("Clear all settings..."), AddAppName(_("Clears all %s settings and re-runs the startup wizard."))); // ------------------------------------------------------------------------ m_menuMisc.Append( &m_MenuItem_Console ); #ifdef __LINUX__ m_menuMisc.Append( &m_MenuItem_Console_Stdio ); #endif //Todo: Though not many people need this one :p //m_menuMisc.Append(MenuId_Profiler, _("Show Profiler"), wxEmptyString, wxITEM_CHECK); //m_menuMisc.AppendSeparator(); // No dialogs implemented for these yet... //m_menuMisc.Append(41, "Patch Browser...", wxEmptyString, wxITEM_NORMAL); //m_menuMisc.Append(42, "Patch Finder...", wxEmptyString, wxITEM_NORMAL); m_menuMisc.AppendSeparator(); //Todo: //There's a great working "open website" in the about panel. Less clutter by just using that. //m_menuMisc.Append(MenuId_Website, _("Visit Website..."), // _("Opens your web-browser to our favorite website.")); m_menuMisc.Append(MenuId_About, _("About...") ); m_menuMisc.AppendSeparator(); m_menuMisc.Append( MenuId_ChangeLang, L"Change Language" ); // Always in English #ifdef PCSX2_DEVBUILD //m_menuDebug.Append(MenuId_Debug_Open, _("Open Debug Window..."), wxEmptyString); //m_menuDebug.Append(MenuId_Debug_MemoryDump, _("Memory Dump..."), wxEmptyString); m_menuDebug.Append(MenuId_Debug_Logging, _("Logging..."), wxEmptyString); #endif m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible ); ConnectMenus(); Connect( wxEVT_MOVE, wxMoveEventHandler (MainEmuFrame::OnMoveAround) ); Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler (MainEmuFrame::OnCloseWindow) ); Connect( wxEVT_SET_FOCUS, wxFocusEventHandler (MainEmuFrame::OnFocus) ); Connect( wxEVT_ACTIVATE, wxActivateEventHandler (MainEmuFrame::OnActivate) ); PushEventHandler( &wxGetApp().GetRecentIsoManager() ); SetDropTarget( new IsoDropTarget( this ) ); ApplyCoreStatus(); ApplySettings(); }
tab_attachments::tab_attachments(wxWindow *parent): wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { // Create all elements sb_attached_files = new wxStaticBox(this, wxID_STATIC, wxEmptyString); clb_attached_files = new wxCheckListBox(this, ID_CLB_ATTACHED_FILES); b_enable_all = new wxButton(this, ID_B_ENABLEALLATTACHED); b_disable_all = new wxButton(this, ID_B_DISABLEALLATTACHED); b_enable_all->Enable(false); b_disable_all->Enable(false); sb_attachments = new wxStaticBox(this, wxID_STATIC, wxEmptyString); lb_attachments = new wxListBox(this, ID_LB_ATTACHMENTS); b_add_attachment = new wxButton(this, ID_B_ADDATTACHMENT); b_remove_attachment = new wxButton(this, ID_B_REMOVEATTACHMENT); b_remove_attachment->Enable(false); wxStaticLine *sl_options = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL); st_name = new wxStaticText(this, wxID_STATIC, wxEmptyString); tc_name = new wxTextCtrl(this, ID_TC_ATTACHMENTNAME); tc_name->SetSizeHints(0, -1); st_description = new wxStaticText(this, wxID_STATIC, wxEmptyString); tc_description = new wxTextCtrl(this, ID_TC_DESCRIPTION); tc_description->SetSizeHints(0, -1); st_mimetype = new wxStaticText(this, wxID_STATIC, wxEmptyString); cob_mimetype = new wxMTX_COMBOBOX_TYPE(this, ID_CB_MIMETYPE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN); cob_mimetype->Append(wxEmptyString); int i; for (i = 0; mime_types[i].name != NULL; i++) cob_mimetype->Append(wxU(mime_types[i].name)); cob_mimetype->SetSizeHints(0, -1); st_style = new wxStaticText(this, wxID_STATIC, wxEmptyString); cob_style = new wxMTX_COMBOBOX_TYPE(this, ID_CB_ATTACHMENTSTYLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY | wxCB_DROPDOWN); cob_style->Append(wxEmptyString); cob_style->Append(wxEmptyString); cob_style->SetSizeHints(0, -1); // Create the layout. wxBoxSizer *siz_line = new wxBoxSizer(wxHORIZONTAL); siz_line->Add(clb_attached_files, 1, wxGROW | wxALL, 5); wxBoxSizer *siz_buttons = new wxBoxSizer(wxVERTICAL); siz_buttons->Add(b_enable_all, 0, wxGROW | wxALL, 5); siz_buttons->Add(b_disable_all, 0, wxGROW | wxALL, 5); siz_buttons->Add(5, 5, 0, wxGROW | wxALL, 5); siz_line->Add(siz_buttons, 0, wxGROW, 0); wxStaticBoxSizer *siz_box_attached_files = new wxStaticBoxSizer(sb_attached_files, wxHORIZONTAL); siz_box_attached_files->Add(siz_line, 1, wxGROW, 0); siz_line = new wxBoxSizer(wxHORIZONTAL); siz_line->Add(lb_attachments, 1, wxGROW | wxALL, 5); siz_buttons = new wxBoxSizer(wxVERTICAL); siz_buttons->Add(b_add_attachment, 0, wxGROW | wxALL, 5); siz_buttons->Add(b_remove_attachment, 0, wxGROW | wxALL, 5); siz_buttons->Add(5, 5, 0, wxGROW | wxALL, 5); siz_line->Add(siz_buttons, 0, wxGROW, 0); wxStaticBoxSizer *siz_box_attachments = new wxStaticBoxSizer(sb_attachments, wxVERTICAL); siz_box_attachments->Add(siz_line, 1, wxGROW, 0); siz_box_attachments->Add(sl_options, 0, wxGROW | wxALL, 5); wxFlexGridSizer *siz_fg = new wxFlexGridSizer(4, 5, 5); siz_fg->AddGrowableCol(1); siz_fg->AddGrowableCol(3); siz_fg->Add(st_name, 0, wxALIGN_CENTER_VERTICAL, 0); siz_fg->Add(tc_name, 1, wxALIGN_CENTER_VERTICAL | wxGROW, 0); siz_fg->Add(st_description, 0, wxALIGN_CENTER_VERTICAL, 0); siz_fg->Add(tc_description, 1, wxALIGN_CENTER_VERTICAL | wxGROW, 0); siz_fg->Add(st_mimetype, 0, wxALIGN_CENTER_VERTICAL, 0); siz_fg->Add(cob_mimetype, 1, wxALIGN_CENTER_VERTICAL | wxGROW, 0); siz_fg->Add(st_style, 0, wxALIGN_CENTER_VERTICAL, 0); siz_fg->Add(cob_style, 1, wxALIGN_CENTER_VERTICAL | wxGROW, 0); siz_box_attachments->Add(siz_fg, 0, wxALL | wxGROW, 5); wxBoxSizer *siz_all = new wxBoxSizer(wxVERTICAL); siz_all->Add(siz_box_attached_files, 1, wxALL | wxGROW, 5); siz_all->Add(siz_box_attachments, 1, wxALL | wxGROW, 5); SetSizer(siz_all); enable(false); selected_attachment = -1; t_get_entries.SetOwner(this, ID_T_ATTACHMENTVALUES); t_get_entries.Start(333); SetDropTarget(new attachments_drop_target_c(this)); }
wex::grid::grid(const window_data& data) : wxGrid( data.parent(), data.id(), data.pos(), data.size(), data.style(), data.name()) { SetDropTarget(new text_droptarget(this)); m_use_drag_and_drop = true; Bind(wxEVT_MENU, [=](wxCommandEvent& event) { empty_selection();}, wxID_DELETE); Bind(wxEVT_MENU, [=](wxCommandEvent& event) { SelectAll();}, wxID_SELECTALL); Bind(wxEVT_MENU, [=](wxCommandEvent& event) { ClearSelection();}, ID_EDIT_SELECT_NONE); Bind(wxEVT_MENU, [=](wxCommandEvent& event) { copy_selected_cells_to_clipboard();}, wxID_COPY); Bind(wxEVT_MENU, [=](wxCommandEvent& event) { copy_selected_cells_to_clipboard(); empty_selection();}, wxID_CUT); Bind(wxEVT_MENU, [=](wxCommandEvent& event) { paste_cells_from_clipboard();}, wxID_PASTE); Bind(wxEVT_FIND, [=](wxFindDialogEvent& event) { find_next( find_replace_data::get()->get_find_string(), find_replace_data::get()->search_down());}); Bind(wxEVT_FIND_NEXT, [=](wxFindDialogEvent& event) { find_next( find_replace_data::get()->get_find_string(), find_replace_data::get()->search_down());}); Bind(wxEVT_GRID_CELL_LEFT_CLICK, [=](wxGridEvent& event) { // Removed extra check for !IsEditable(), // drag/drop is different from editing, so allow that. if (!IsSelection()) { event.Skip(); return; } if (m_use_drag_and_drop) { // This is because drag/drop is not really supported by the wxGrid. // Even the wxEVT_GRID_CELL_BEGIN_DRAG does not seem to come in. // Therefore, we are really dragging if you click again in // your selection and move mouse and drop elsewhere. // So, if not clicked in the selection, do nothing, this was no drag. if (!IsInSelection(event.GetRow(), event.GetCol())) { event.Skip(); return; } // Is it allowed to drag current selection?? if (!is_allowed_drag_selection()) { event.Skip(); return; } // Start drag operation. wxTextDataObject textData(get_selected_cells_value()); wxDropSource source(textData, this); wxDragResult result = source.DoDragDrop(wxDrag_DefaultMove); if (result != wxDragError && result != wxDragNone && result != wxDragCancel) { // The old contents is not deleted, as should be by moving. // To fix this, do not call Skip so selection remains active, // and call empty_selection. // event.Skip(); empty_selection(); ClearSelection(); } else { // Do not call Skip so selection remains active. // event.Skip(); } } else { event.Skip(); } }); Bind(wxEVT_GRID_CELL_RIGHT_CLICK, [=](wxGridEvent& event) { int style = (IsEditable() ? wex::menu::DEFAULT: wex::menu::IS_READ_ONLY); if (IsSelection()) style |= wex::menu::IS_SELECTED; wex::menu menu(style); build_popup_menu(menu); PopupMenu(&menu); }); Bind(wxEVT_GRID_SELECT_CELL, [=](wxGridEvent& event) { frame::statustext( std::to_string(1 + event.GetCol()) + "," + std::to_string(1 + event.GetRow()), "PaneInfo"); event.Skip();}); Bind(wxEVT_GRID_RANGE_SELECT, [=](wxGridRangeSelectEvent& event) { event.Skip(); frame::statustext(std::to_string(GetSelectedCells().GetCount()), "PaneInfo"); }); Bind(wxEVT_SET_FOCUS, [=](wxFocusEvent& event) { wex::frame* frame = dynamic_cast<wex::frame*>(wxTheApp->GetTopWindow()); if (frame != nullptr) { frame->set_find_focus(this); } event.Skip();}); }
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(NULL) , m_file_menu_sep(false) , m_page_panel(NULL) , m_bs_main(NULL) , m_bs_page(NULL) , 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(wxIcon(mkvmergeGUI_xpm)); SetDropTarget(new header_editor_drop_target_c(this)); set_status_bar(Z("Header editor ready.")); }
wxGxTreeView::wxGxTreeView(wxWindow* parent, wxWindowID id, long style) : wxGxTreeViewBase(parent, id, wxDefaultPosition, wxDefaultSize, style) { SetDropTarget(new wxGISDropTarget(static_cast<IViewDropTarget*>(this))); }
bool Viewer::Init(const std::string params) { m_dropTarget = new DropTarget(this); m_normalRect = wxToRect(GetRect()); Bind(wxEVT_CLOSE_WINDOW, [&](wxCloseEvent& evt) { PerformOnClose(); evt.Skip(); }); ViewportBuilder b; b.BuildViewport(m_viewPort, this, m_cfg); m_adjust = std::make_shared<Adjust>(this); m_adjust->OnChange.connect([this](int a, int b, int c) { AdjustChange(a, b, c); }); m_mouseMap.AddAction(MouseFullscreen, [this](Win::MouseEvent) { ToggleFullscreenMode(); }); m_mouseMap.AddAction(MouseToggleFullSizeDefaultZoom, [&](Win::MouseEvent) { ZoomToggleFullSizeDefaultZoom(); }); m_mouseMap.AddAction(MouseNextImage, [this](Win::MouseEvent) { ImageNext(1); }); m_mouseMap.AddAction(MousePrevImage, [this](Win::MouseEvent) { ImagePrev(1); }); m_mouseMap.AddAction(MouseZoomIn, [this](Win::MouseEvent) { ZoomIn(); }); m_mouseMap.AddAction(MouseZoomOut, [this](Win::MouseEvent) { ZoomOut(); }); m_mouseMap.AddAction(MouseContext, [this](Win::MouseEvent e) { ShowContextMenu(e); }); m_mouseMap.AddAction(MouseRotateLeft, [this](Win::MouseEvent) { RotateLeft(); }); m_mouseMap.AddAction(MouseRotateRight, [this](Win::MouseEvent) { RotateRight(); }); m_contextMenu.Construct(this); m_keys.Construct(this); m_keys.SetBindings(m_cfg.Keyboard); m_lang = Intl::OnLanguageChanged.connect([&]() { UpdateImageInformation(); }); m_cacher.SetCodecFactoryStore(m_codecs); UpdateViewportConfig(); // Apply some settings that can't be set automatically UpdateMemoryLimits(); m_cacher.MessageTarget(this); // TODO: FIXME: This is very wrong, should be set to something that isn't hardcoded. m_cacher.SetMaximumResolutionHint(Geom::SizeInt(25600, 25600)); m_folderMonitor.OnEvent.connect([this](IO::FileEvent e) { AddNotification(e); }); m_cacher.WrapAround(m_cfg.View.BrowseWrapAround); AlwaysOnTop(m_cfg.View.AlwaysOnTop); ZoomMode(m_cfg.View.DefaultZoomMode); if (m_cfg.View.Maximized) { m_doMaximize = true; } m_viewPort.Init(); m_statusBar = CreateStatusBar(7); int widths[] = { StatFieldZoomWidth, -1, StatFieldImageDimWidth, StatFieldPosWidth, StatFieldTimeWidth, StatFieldFileSizeWidth, StatFieldLastModified }; m_statusBar->SetStatusWidths(7, widths); m_statusBar->Show(m_cfg.View.ShowStatusBar); SetImageLocation(params); SetDropTarget(m_dropTarget); return true; }
void wxSTEditorFrame::CreateOptions( const wxSTEditorOptions& options ) { m_options = options; wxConfigBase *config = GetConfigBase(); wxSTEditorMenuManager *steMM = GetOptions().GetMenuManager(); if (steMM && GetOptions().HasFrameOption(STF_CREATE_MENUBAR)) { wxMenuBar *menuBar = GetMenuBar(); if (!menuBar) menuBar = new wxMenuBar(wxMB_DOCKABLE); steMM->CreateMenuBar(menuBar, true); SetMenuBar(menuBar); wxAcceleratorHelper::SetAcceleratorTable(this, *steMM->GetAcceleratorArray()); wxAcceleratorHelper::SetAccelText(menuBar, *steMM->GetAcceleratorArray()); if (GetOptions().HasFrameOption(STF_CREATE_FILEHISTORY) && !GetOptions().GetFileHistory()) { // If there is wxID_OPEN then we can use wxFileHistory to save them wxMenu* menu = NULL; wxMenuItem* item = menuBar->FindItem(wxID_OPEN, &menu); if (menu && item) { int open_index = menu->GetMenuItems().IndexOf(item); if (open_index != wxNOT_FOUND) { wxMenu* submenu = new wxMenu(); menu->Insert(open_index + 1, wxID_ANY, _("Open &Recent"), submenu); GetOptions().SetFileHistory(new wxFileHistory(9), false); GetOptions().GetFileHistory()->UseMenu(submenu); if (config) { GetOptions().LoadFileConfig(*config); } } } GetOptions().SetMenuBar(menuBar); } } if (steMM && GetOptions().HasFrameOption(STF_CREATE_TOOLBAR)) { wxToolBar* toolBar = (GetToolBar() != NULL) ? GetToolBar() : CreateToolBar(); steMM->CreateToolBar(toolBar); GetOptions().SetToolBar(toolBar); } if ((GetStatusBar() == NULL) && GetOptions().HasFrameOption(STF_CREATE_STATUSBAR)) { CreateStatusBar(1); GetOptions().SetStatusBar(GetStatusBar()); } if (steMM) { if (GetOptions().HasEditorOption(STE_CREATE_POPUPMENU)) { wxMenu* menu = steMM->CreateEditorPopupMenu(); wxAcceleratorHelper::SetAccelText(menu, *steMM->GetAcceleratorArray()); GetOptions().SetEditorPopupMenu(menu, false); } if (GetOptions().HasSplitterOption(STS_CREATE_POPUPMENU)) GetOptions().SetSplitterPopupMenu(steMM->CreateSplitterPopupMenu(), false); if (GetOptions().HasNotebookOption(STN_CREATE_POPUPMENU)) GetOptions().SetNotebookPopupMenu(steMM->CreateNotebookPopupMenu(), false); } if (!m_sideSplitter && GetOptions().HasFrameOption(STF_CREATE_SIDEBAR)) { m_sideSplitter = new wxSplitterWindow(this, ID_STF_SIDE_SPLITTER); m_sideSplitter->SetMinimumPaneSize(10); m_sideNotebook = new wxNotebook(m_sideSplitter, ID_STF_SIDE_NOTEBOOK); m_steTreeCtrl = new wxSTEditorTreeCtrl(m_sideNotebook, ID_STF_FILE_TREECTRL); m_dirCtrl = new wxGenericDirCtrl(m_sideNotebook, ID_STF_FILE_DIRCTRL, wxFileName::GetCwd(), wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL #if wxCHECK_VERSION(2, 9, 2) |(GetOptions().HasFrameOption(STF_CREATE_NOTEBOOK) ? wxDIRCTRL_MULTIPLE : 0) #endif // wxCHECK_VERSION(2, 9, 2) ); m_sideNotebook->AddPage(m_steTreeCtrl, _("Files")); m_sideNotebook->AddPage(m_dirCtrl, _("Open")); m_sideSplitterWin1 = m_sideNotebook; } if (!m_steNotebook && GetOptions().HasFrameOption(STF_CREATE_NOTEBOOK)) { m_mainSplitter = new wxSplitterWindow(m_sideSplitter ? (wxWindow*)m_sideSplitter : (wxWindow*)this, ID_STF_MAIN_SPLITTER); m_mainSplitter->SetMinimumPaneSize(1); m_steNotebook = new wxSTEditorNotebook(m_mainSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); m_steNotebook->CreateOptions(m_options); (void)m_steNotebook->InsertEditorSplitter(-1, wxID_ANY, GetOptions().GetDefaultFileName(), true); // update after adding a single page m_steNotebook->UpdateAllItems(); m_mainSplitter->Initialize(m_steNotebook); m_mainSplitterWin1 = m_steNotebook; m_sideSplitterWin2 = m_mainSplitter; if (m_steTreeCtrl) m_steTreeCtrl->SetSTENotebook(m_steNotebook); } else if (!m_steSplitter && GetOptions().HasFrameOption(STF_CREATE_SINGLEPAGE)) { m_mainSplitter = new wxSplitterWindow(m_sideSplitter ? (wxWindow*)m_sideSplitter : (wxWindow*)this, ID_STF_MAIN_SPLITTER); m_mainSplitter->SetMinimumPaneSize(1); m_steSplitter = new wxSTEditorSplitter(m_mainSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0); m_steSplitter->CreateOptions(m_options); m_mainSplitter->Initialize(m_steSplitter); m_mainSplitterWin1 = m_steSplitter; } //else user will set up the rest if (m_mainSplitter && m_mainSplitterWin1 && !m_resultsNotebook && GetOptions().HasFrameOption(STF_CREATE_RESULT_NOTEBOOK)) { m_resultsNotebook = new wxNotebook(m_mainSplitter, wxID_ANY); m_findResultsEditor = new wxSTEditorFindResultsEditor(m_resultsNotebook, wxID_ANY); m_findResultsEditor->CreateOptionsFromEditorOptions(options); m_resultsNotebook->AddPage(m_findResultsEditor, _("Search Results")); wxSTEditorFindReplacePanel::SetFindResultsEditor(m_findResultsEditor); m_mainSplitter->SplitHorizontally(m_mainSplitterWin1, m_resultsNotebook, GetClientSize().GetHeight()*2/3); m_mainSplitterWin2 = m_resultsNotebook; } if (GetOptions().HasFrameOption(STF_CREATE_SIDEBAR) && GetSideSplitter() && m_sideSplitterWin1 && m_sideSplitterWin2) { GetSideSplitter()->SplitVertically(m_sideSplitterWin1, m_sideSplitterWin2, m_sideSplitter_pos); } #if wxUSE_DRAG_AND_DROP if (GetOptions().HasFrameOption(STF_DO_DRAG_AND_DROP)) { SetDropTarget(new wxSTEditorFileDropTarget(this)); } #endif //wxUSE_DRAG_AND_DROP if (GetOptions().HasConfigOption(STE_CONFIG_FINDREPLACE) && config) { if (GetOptions().GetFindReplaceData() && !GetOptions().GetFindReplaceData()->HasLoadedConfig()) GetOptions().GetFindReplaceData()->LoadConfig(*config); } if (config) LoadConfig(*config); // The config may change the frame size so relayout the splitters if (m_mainSplitter && m_mainSplitter->IsSplit()) //m_mainSplitterWin1 && m_resultsNotebook) m_mainSplitter->SetSashPosition(GetClientSize().GetHeight()*2/3); UpdateAllItems(); // if we've got an editor let it update gui wxSTEditor *editor = GetEditor(); if (editor) editor->UpdateAllItems(); }
// ---------------------------------------------------------------------------- void SnippetProperty::InitSnippetProperty(wxTreeCtrl* pTree, wxTreeItemId itemId, wxSemaphore* pWaitSem) // ---------------------------------------------------------------------------- { // ctor initialization // The scintilla Editor is allocated by SnippetPropertyForm m_pWaitingSemaphore = pWaitSem; m_nScrollWidthMax = 0; // Move dialog into midpoint of parent window wxPoint mousePosn = ::wxGetMousePosition(); this->Move(mousePosn.x, mousePosn.y); this->SetSize(mousePosn.x, mousePosn.y, 460, 260); //SetSize(460, 260); GetConfig()->CenterChildOnParent(this); m_pTreeCtrl = pTree; m_TreeItemId = itemId; // Initialize the properties fields m_ItemLabelTextCtrl->SetValue( pTree->GetItemText(itemId) ); m_ItemLabelTextCtrl->Connect(wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( SnippetProperty::OnOk ), NULL, this ); m_SnippetEditCtrl->SetText( wxT("Enter text or Filename") ); m_SnippetEditCtrl->SetFocus(); wxColour txtBackground = m_ItemLabelTextCtrl->GetBackgroundColour(); //m_SnippetEditCtrl->SetBackgroundColour(txtBackground); m_SnippetEditCtrl->StyleSetBackground (wxSCI_STYLE_DEFAULT, txtBackground); m_SnippetEditCtrl->StyleClearAll(); // Get the item if (( m_pSnippetDataItem = (SnippetItemData*)(pTree->GetItemData(itemId)))) { // Check that we're using the correct item type if (m_pSnippetDataItem->GetType() != SnippetItemData::TYPE_SNIPPET) { // This shouldn't happen since the context menu only shows // properties on TYPE_SNIPPET return; } wxString snippetText = m_pSnippetDataItem->GetSnippet() ; if ( not snippetText.IsEmpty() ) { GetSnippetEditCtrl()-> SetText( snippetText ); GetSnippetEditCtrl()->SetSavePoint(); // SetText() marked the file as modified // Unmarked it by saving to a dummy file //#if defined(__WXMSW__) // m_SnippetEditCtrl->SaveFile(wxT("nul")); //#else // m_SnippetEditCtrl->SaveFile(wxT("/dev/null")); //#endif // reset the undo history to avoid undoing to a blank page m_SnippetEditCtrl->EmptyUndoBuffer(); }//if // reset horiz scroll max width //-m_nScrollWidthMax = GetSnippetEditCtrl()->GetLongestLinePixelWidth(); //-GetSnippetEditCtrl()->SetScrollWidth(m_nScrollWidthMax); }//if SetDropTarget(new SnippetDropTarget(this)); }//SnippetProperty ctor
// ---------------------------------------------------------------------------- bool ThreadSearchFrame::InitThreadSearchFrame(wxFrame* appFrame, const wxString& title) // ---------------------------------------------------------------------------- { GetConfig()->SetThreadSearchFrame( this ); // create a menu bar CreateMenuBar(); // create a status bar with some information about the used wxWidgets version CreateStatusBar(2); SetStatusText(_("CodeSnippets Search"),0); SetStatusText(wxbuildinfo(short_f), 1); InitializeRecentFilesHistory(); // -not used yet- // allocate a separate EditorManager/Notebook if (not GetConfig()->GetEditorManager(this)) { SEditorManager* m_pEdMan = new SEditorManager(this); GetConfig()->RegisterEditorManager(this, m_pEdMan); }//if GetEditorManager // create ThreadSearch and alter its menu items m_pThreadSearch = new ThreadSearch( this ); if ( m_pThreadSearch ) do { m_pThreadSearch->ThreadSearch::m_IsAttached = true; m_pThreadSearch->OnAttach(); PushEventHandler(m_pThreadSearch); m_pThreadSearch->SetEvtHandlerEnabled( true ); // add View and Search menu items wxMenuBar* pMenuBar = this->GetMenuBar(); wxMenu* pMenuView = new wxMenu(); //-wxMenu* pMenuSearch = pMenuBar->GetMenu( pMenuBar->FindMenu(_T("Search"))); pMenuBar->Insert( 1, pMenuView, _T("View")); //-pMenuBar->Insert( 2, pMenuSearch, _T("Search")); m_pThreadSearch->BuildMenu( pMenuBar ); // Change 'View/ThreadSearch' to 'View/Options' int idOptionsThreadSearch = pMenuBar->FindMenuItem(_T("View"),_T("Snippets search")); if (idOptionsThreadSearch not_eq wxNOT_FOUND) { pMenuBar->SetLabel( idOptionsThreadSearch, _T("Options...") ); m_pThreadSearch->Connect(idOptionsThreadSearch, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(ThreadSearchFrame::OnMenuOptions), NULL, this); } // create tool bar and hide it (avoids bar reference crashes) wxToolBar* pToolBar = new wxToolBar(this, -1); if ( m_pThreadSearch ) m_pThreadSearch->BuildToolBar( pToolBar ); pToolBar->Hide(); // move frame to last know frame position ConfigManager* pCfg = Manager::Get()->GetConfigManager(_T("SnippetsSearch")); int xPos = pCfg->ReadInt( wxT("/FramePosX"), 120); int yPos = pCfg->ReadInt( wxT("/FramePosY"), 60); int width = pCfg->ReadInt( wxT("/FrameWidth"), 120); int height = pCfg->ReadInt( wxT("/FrameHeight"), 60); SetSize( xPos, yPos, width, height); // Catch Destroyed windows Connect( wxEVT_DESTROY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &ThreadSearchFrame::OnWindowDestroy); // Allow filenames to be dropped/opened on ThreadSearchFrame SetDropTarget(new wxMyFileDropTarget(this)); GetConfig()->GetEditorManager(this)->GetNotebook()->SetDropTarget(new wxMyFileDropTarget(this)); }while(false);//if m_pThreadSearch do return m_pThreadSearch; }//initThreadSearchFrame ctor