void OpenWithContainerWindow::RestoreState() { BNode defaultingNode; if (DefaultStateSourceNode(kDefaultOpenWithTemplate, &defaultingNode, false)) { AttributeStreamFileNode streamNodeSource(&defaultingNode); RestoreWindowState(&streamNodeSource); fPoseView->Init(&streamNodeSource); } else { RestoreWindowState(NULL); fPoseView->Init(NULL); } }
void TFilePanel::RestoreState() { BNode defaultingNode; if (DefaultStateSourceNode(kDefaultFilePanelTemplate, &defaultingNode, false)) { AttributeStreamFileNode streamNodeSource(&defaultingNode); RestoreWindowState(&streamNodeSource); PoseView()->Init(&streamNodeSource); } else { RestoreWindowState(NULL); PoseView()->Init(NULL); } }
MergeSummaryDialog::MergeSummaryDialog(wxWindow *parent) { wxXmlResource::Get()->LoadDialog(this, parent, "summary"); RestoreWindowState(this, wxDefaultSize, WinState_Size); CentreOnParent(); }
FileViewer::FileViewer(wxWindow *parent, const wxString& basePath, const wxArrayString& references, int startAt) : wxFrame(parent, -1, _("Source file")), m_references(references) { m_basePath = basePath; SetName("fileviewer"); wxPanel *panel = new wxPanel(this, -1); wxSizer *sizer = new wxBoxSizer(wxVERTICAL); panel->SetSizer(sizer); wxSizer *barsizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(barsizer, wxSizerFlags().Expand().Border()); barsizer->Add(new wxStaticText(panel, wxID_ANY, _("Source file occurrence:")), wxSizerFlags().Center().Border(wxRIGHT)); wxChoice *choice = new wxChoice(panel, wxID_ANY); barsizer->Add(choice, wxSizerFlags(1).Center()); for (size_t i = 0; i < references.Count(); i++) choice->Append(references[i]); choice->SetSelection(startAt); wxButton *edit = new wxButton(panel, wxID_ANY, _("Open In Editor")); barsizer->Add(edit, wxSizerFlags().Center().Border(wxLEFT, 10)); m_text = new wxStyledTextCtrl(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME); SetupTextCtrl(); sizer->Add(m_text, 1, wxEXPAND); RestoreWindowState(this, wxSize(600, 400)); wxSizer *topsizer = new wxBoxSizer(wxVERTICAL); topsizer->Add(panel, wxSizerFlags(1).Expand()); SetSizer(topsizer); Layout(); choice->Bind(wxEVT_CHOICE, &FileViewer::OnChoice, this); edit->Bind(wxEVT_BUTTON, &FileViewer::OnEditFile, this); ShowReference(m_references[startAt]); #ifdef __WXOSX__ wxAcceleratorEntry entries[] = { { wxACCEL_CMD, 'W', wxID_CLOSE } }; wxAcceleratorTable accel(WXSIZEOF(entries), entries); SetAcceleratorTable(accel); Bind(wxEVT_MENU, [=](wxCommandEvent&){ Destroy(); }, wxID_CLOSE); #endif }
ManagerFrame::ManagerFrame() : wxFrame(NULL, -1, _("Poedit - Catalogs manager"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE, "manager") { #if defined(__WXGTK__) wxIconBundle appicons; appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(16,16))); appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(32,32))); appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(48,48))); SetIcons(appicons); #elif defined(__WXMSW__) SetIcons(wxIconBundle(wxStandardPaths::Get().GetResourcesDir() + "\\Resources\\Poedit.ico")); #endif ms_instance = this; auto tb = wxXmlResource::Get()->LoadToolBar(this, "manager_toolbar"); (void)tb; #ifdef __WXMSW__ // De-uglify the toolbar a bit on Windows 10: if (IsWindows10OrGreater()) { const wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive(); if (theme) { wxUxThemeHandle hTheme(tb, L"ExplorerMenu::Toolbar"); tb->SetBackgroundColour(wxRGBToColour(theme->GetThemeSysColor(hTheme, COLOR_WINDOW))); } } #endif wxPanel *panel = wxXmlResource::Get()->LoadPanel(this, "manager_panel"); m_listPrj = XRCCTRL(*panel, "prj_list", wxListBox); m_listCat = XRCCTRL(*panel, "prj_files", wxListCtrl); m_splitter = XRCCTRL(*panel, "manager_splitter", wxSplitterWindow); wxImageList *list = new wxImageList(PX(16), PX(16)); list->Add(wxArtProvider::GetBitmap("poedit-status-cat-no")); list->Add(wxArtProvider::GetBitmap("poedit-status-cat-mid")); list->Add(wxArtProvider::GetBitmap("poedit-status-cat-ok")); m_listCat->AssignImageList(list, wxIMAGE_LIST_SMALL); m_curPrj = -1; int last = (int)wxConfig::Get()->Read("manager_last_selected", (long)0); // FIXME: do this in background (here and elsewhere) UpdateListPrj(last); if (m_listPrj->GetCount() > 0) UpdateListCat(last); RestoreWindowState(this, wxSize(PX(400), PX(300))); m_splitter->SetSashPosition((int)wxConfig::Get()->Read("manager_splitter", PX(200))); }
FindFrame::FindFrame(wxWindow *parent, PoeditListCtrl *list, Catalog *c, wxTextCtrl *textCtrlOrig, wxTextCtrl *textCtrlTrans, wxTextCtrl *textCtrlComments, wxTextCtrl *textCtrlAutoComments) : m_listCtrl(list), m_catalog(c), m_position(-1), m_textCtrlOrig(textCtrlOrig), m_textCtrlTrans(textCtrlTrans), m_textCtrlComments(textCtrlComments), m_textCtrlAutoComments(textCtrlAutoComments) { wxXmlResource::Get()->LoadDialog(this, parent, "find_frame"); m_textField = XRCCTRL(*this, "string_to_find", wxTextCtrl); SetEscapeId(wxID_CLOSE); RestoreWindowState(this, wxDefaultSize, WinState_Pos); m_btnNext = XRCCTRL(*this, "find_next", wxButton); m_btnPrev = XRCCTRL(*this, "find_prev", wxButton); if ( !ms_text.empty() ) { m_textField->SetValue(ms_text); m_textField->SelectAll(); } Reset(c); XRCCTRL(*this, "in_orig", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("find_in_orig", true)); XRCCTRL(*this, "in_trans", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("find_in_trans", true)); XRCCTRL(*this, "in_comments", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("find_in_comments", true)); XRCCTRL(*this, "in_auto_comments", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("find_in_auto_comments", true)); XRCCTRL(*this, "case_sensitive", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("find_case_sensitive", false)); XRCCTRL(*this, "from_first", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("find_from_first", true)); XRCCTRL(*this, "whole_words", wxCheckBox)->SetValue( wxConfig::Get()->ReadBool("whole_words", false)); #ifdef __WXOSX__ wxAcceleratorEntry entries[] = { { wxACCEL_CMD, 'W', wxID_CLOSE } }; wxAcceleratorTable accel(WXSIZEOF(entries), entries); SetAcceleratorTable(accel); #endif }
void TFilePanel::RestoreState() { BNode defaultingNode; if (DefaultStateSourceNode(kDefaultFilePanelTemplate, &defaultingNode, false)) { AttributeStreamFileNode streamNodeSource(&defaultingNode); RestoreWindowState(&streamNodeSource); PoseView()->Init(&streamNodeSource); } else { RestoreWindowState(NULL); PoseView()->Init(NULL); } // Finish UI creation now that the PoseView is initialized BLayoutItem* item = fBorderedView->GroupLayout()->AddView(0, fPoseView->TitleView()); BSize minSize = item->MinSize(); BSize maxSize = item->MaxSize(); item->SetExplicitMinSize(BSize(minSize.Width(), kTitleViewHeight)); item->SetExplicitMaxSize(BSize(maxSize.Width(), kTitleViewHeight)); BRect rect(fBorderedView->Frame()); rect.right = rect.left + kCountViewWidth; rect.top = rect.bottom + 1; rect.bottom = rect.top + PoseView()->HScrollBar()->Bounds().Height() - 1; PoseView()->CountView()->MoveTo(rect.LeftTop()); PoseView()->CountView()->ResizeTo(rect.Size()); PoseView()->CountView()->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); fBackView->AddChild(PoseView()->CountView(), fBorderedView); PoseView()->HScrollBar()->MoveBy(kCountViewWidth + 1, 0); PoseView()->HScrollBar()->ResizeBy(-kCountViewWidth - 1, 0); // The Be Book states that the BTitleView will have a name of "TitleView", // and so some apps will try to grab it by that name and move it around. // They don't need to, because resizing "PoseView" (really the BorderedView) // will resize the BTitleView as well. So just create a dummy view here // so that they don't get NULL when trying to find the view. BView* dummyTitleView = new BView(BRect(), "TitleView", B_FOLLOW_NONE, 0); fBackView->AddChild(dummyTitleView); dummyTitleView->Hide(); }
ManagerFrame::ManagerFrame() : wxFrame(NULL, -1, _("Poedit - Catalogs manager"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE, "manager") { #if defined(__WXGTK__) wxIconBundle appicons; appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(16,16))); appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(32,32))); appicons.AddIcon(wxArtProvider::GetIcon("poedit", wxART_FRAME_ICON, wxSize(48,48))); SetIcons(appicons); #elif defined(__WXMSW__) SetIcon(wxICON(appicon)); #endif ms_instance = this; wxXmlResource::Get()->LoadToolBar(this, "manager_toolbar"); wxXmlResource::Get()->LoadMenuBar(this, "manager_menu"); wxPanel *panel = wxXmlResource::Get()->LoadPanel(this, "manager_panel"); m_listPrj = XRCCTRL(*panel, "prj_list", wxListBox); m_listCat = XRCCTRL(*panel, "prj_files", wxListCtrl); m_splitter = XRCCTRL(*panel, "manager_splitter", wxSplitterWindow); wxImageList *list = new wxImageList(16, 16); list->Add(wxArtProvider::GetBitmap("poedit-status-cat-no")); list->Add(wxArtProvider::GetBitmap("poedit-status-cat-mid")); list->Add(wxArtProvider::GetBitmap("poedit-status-cat-ok")); m_listCat->AssignImageList(list, wxIMAGE_LIST_SMALL); m_curPrj = -1; int last = (int)wxConfig::Get()->Read("manager_last_selected", (long)0); // FIXME: do this in background (here and elsewhere) UpdateListPrj(last); if (m_listPrj->GetCount() > 0) UpdateListCat(last); RestoreWindowState(this, wxSize(400, 300)); m_splitter->SetSashPosition(wxConfig::Get()->Read("manager_splitter", 200)); }
void QCustomDialog::InitDialog() { // Define handler for standard buttons if (OkBt) { OkBt->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); connect(OkBt,SIGNAL(clicked()),this,SLOT(accept())); } if (CancelBt) { CancelBt->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); connect(CancelBt,SIGNAL(clicked()),this,SLOT(reject())); } if (UndoBt) { UndoBt->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogResetButton)); connect(UndoBt,SIGNAL(clicked()),this,SLOT(DoPartialUndo())); } if (HelpBt) { HelpBt->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogHelpButton)); connect(HelpBt,SIGNAL(clicked()),this,SLOT(help())); } // Restore window size and position RestoreWindowState(); // Initialise dialog DoInitDialog(); // Prepare undo PrepareGlobalUndo(); if (UndoBt) UndoBt->setEnabled(UndoDataList.count()>0); toolTipTowhatsThis(this); if (!HelpFile.isEmpty() && ApplicationConfig->WikiFollowInterface) { ApplicationConfig->PopupHelp->SaveLatestHelpFile(); ApplicationConfig->PopupHelp->OpenHelp(HelpFile,false); } }