ChangeNodeHeirarchy::ChangeNodeHeirarchy(HierarchyTreeNode::HIERARCHYTREENODEID targetNodeID, HierarchyTreeNode::HIERARCHYTREENODEID afterNodeID, HierarchyTreeNode::HIERARCHYTREENODESIDLIST items) { this->targetNodeID = targetNodeID; this->afterNodeID = afterNodeID; this->items = items; DVASSERT(items.empty() == false); HierarchyTreeNode* itemNode = HierarchyTreeController::Instance()->GetTree().GetNode((items.front())); DetectType(itemNode); // Remember the previous parent IDs for the commands. Note - we cannot store just pointers // to the parents since they may gone. StorePreviousParents(); }
DeleteSelectedNodeCommand::DeleteSelectedNodeCommand(const HierarchyTreeNode::HIERARCHYTREENODESLIST& nodes, bool needDeleteFiles) { this->nodes = nodes; this->deleteFiles = needDeleteFiles; DVASSERT(nodes.empty() == false); HierarchyTreeNode* itemNode = nodes.front(); DetectType(itemNode); if (type == TYPE_AGGREGATOR) { StoreParentsOfRemovingAggregatorControls(nodes); } parentId = itemNode->GetParent()->GetId(); }
void MadFileAssociationDialog::WxButtonOKClick(wxCommandEvent& event) { wxConfigBase *cfg=wxConfigBase::Get(false); wxString oldpath=cfg->GetPath(); // clear old filetypes cfg->DeleteGroup(wxT("/AssociatedFileTypes")); cfg->SetPath(wxT("/AssociatedFileTypes")); // remove types int idx=0; int count = int(as_remove.Count()); wxString type; while(idx<count) { type = as_remove[idx]; if(DetectType(type)) { RemoveType(type); } ++idx; } // add types idx=0; count = int(WxListBoxAssociated->GetCount()); while(idx<count) { type = WxListBoxAssociated->GetString(idx); AddType(type); cfg->Write(wxString()<<idx, type); ++idx; } cfg->SetPath(oldpath); Close(); }
MadFileAssociationDialog::MadFileAssociationDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { //(*Initialize(MadFileAssociationDialog) wxBoxSizer* BoxSizer4; wxBoxSizer* BoxSizer6; wxBoxSizer* BoxSizer5; wxBoxSizer* BoxSizer7; wxBoxSizer* BoxSizer8; wxBoxSizer* BoxSizer2; wxBoxSizer* BoxSizer1; wxBoxSizer* BoxSizer3; Create(parent, wxID_ANY, _("File Type Associations"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX, _T("wxID_ANY")); BoxSizer1 = new wxBoxSizer(wxVERTICAL); BoxSizer2 = new wxBoxSizer(wxVERTICAL); BoxSizer4 = new wxBoxSizer(wxHORIZONTAL); BoxSizer6 = new wxBoxSizer(wxVERTICAL); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Associated File Types:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); BoxSizer6->Add(StaticText1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); WxListBoxAssociated = new wxListBox(this, ID_WXLISTBOXASSOCIATED, wxDefaultPosition, wxSize(121,200), 0, 0, wxLB_EXTENDED, wxDefaultValidator, _T("ID_WXLISTBOXASSOCIATED")); BoxSizer6->Add(WxListBoxAssociated, 1, wxALL|wxEXPAND, 5); BoxSizer4->Add(BoxSizer6, 1, wxALL|wxEXPAND, 5); BoxSizer7 = new wxBoxSizer(wxVERTICAL); WxButtonAdd = new wxButton(this, ID_WXBUTTONADD, _("<- Add"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_WXBUTTONADD")); BoxSizer7->Add(WxButtonAdd, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); WxButtonRemove = new wxButton(this, ID_WXBUTTONREMOVE, _("Remove ->"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_WXBUTTONREMOVE")); BoxSizer7->Add(WxButtonRemove, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer4->Add(BoxSizer7, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer8 = new wxBoxSizer(wxVERTICAL); StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Predefined File Types:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); BoxSizer8->Add(StaticText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); WxListBoxPredefined = new wxListBox(this, ID_WXLISTBOXPREDEFINED, wxDefaultPosition, wxSize(121,200), 0, 0, wxLB_EXTENDED, wxDefaultValidator, _T("ID_WXLISTBOXPREDEFINED")); BoxSizer8->Add(WxListBoxPredefined, 1, wxALL|wxEXPAND, 5); BoxSizer4->Add(BoxSizer8, 1, wxALL|wxEXPAND, 5); BoxSizer2->Add(BoxSizer4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); BoxSizer5 = new wxBoxSizer(wxHORIZONTAL); WxEditCustomType = new wxTextCtrl(this, ID_WXEDITCUSTOMTYPE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_WXEDITCUSTOMTYPE")); BoxSizer5->Add(WxEditCustomType, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); WxButtonAddCustom = new wxButton(this, ID_WXBUTTONADDCUSTOM, _("<- Add Custom File Type"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_WXBUTTONADDCUSTOM")); BoxSizer5->Add(WxButtonAddCustom, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer2->Add(BoxSizer5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer3 = new wxBoxSizer(wxHORIZONTAL); WxButtonOK = new wxButton(this, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_OK")); BoxSizer3->Add(WxButtonOK, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); WxButtonCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_CANCEL")); WxButtonCancel->SetDefault(); BoxSizer3->Add(WxButtonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); BoxSizer1->Add(BoxSizer3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(BoxSizer1); BoxSizer1->Fit(this); BoxSizer1->SetSizeHints(this); Center(); Bind( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &MadFileAssociationDialog::WxListBoxAssociatedDoubleClicked, this, ID_WXLISTBOXASSOCIATED ); Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadFileAssociationDialog::WxButtonAddClick, this, ID_WXBUTTONADD ); Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadFileAssociationDialog::WxButtonRemoveClick, this, ID_WXBUTTONREMOVE ); Bind( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, &MadFileAssociationDialog::WxListBoxPredefinedDoubleClicked, this, ID_WXLISTBOXPREDEFINED ); Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadFileAssociationDialog::WxButtonAddCustomClick, this, ID_WXBUTTONADDCUSTOM ); Bind( wxEVT_COMMAND_BUTTON_CLICKED, &MadFileAssociationDialog::WxButtonOKClick, this, wxID_OK ); //*) wxArrayString as_predefined(g_PredefinedTypes_Count, g_PredefinedTypes); wxConfigBase *cfg=wxConfigBase::Get(false); wxString oldpath=cfg->GetPath(); cfg->SetPath(wxT("/AssociatedFileTypes")); int idx=0, idx2; wxString type; while(cfg->Read(wxString()<<idx, &type)) { if(DetectType(type)) { WxListBoxAssociated->Append(type); if((idx2=as_predefined.Index(type.c_str()))!=wxNOT_FOUND) { as_predefined.RemoveAt(idx2); } } ++idx; } WxListBoxPredefined->Set(as_predefined); cfg->SetPath(oldpath); WxButtonCancel->SetFocus(); }
void MadFileAssociationDialog::CreateGUIControls() { //do not set FontName, it is not exist on all platforms #define wxFont(p0,p1,p2,p3,p4,p5) wxFont(wxDEFAULT,wxDEFAULT,p2,p3,p4) //Do not add custom code between //GUI Items Creation Start and GUI Items Creation End. //wxDev-C++ designer will remove them. //Add the custom code before or after the blocks ////GUI Items Creation Start WxBoxSizer1 = new wxBoxSizer(wxVERTICAL); this->SetSizer(WxBoxSizer1); this->SetAutoLayout(true); WxBoxSizer2 = new wxBoxSizer(wxVERTICAL); WxBoxSizer1->Add(WxBoxSizer2, 0, wxALIGN_CENTER | wxALL, 5); WxBoxSizer4 = new wxBoxSizer(wxHORIZONTAL); WxBoxSizer2->Add(WxBoxSizer4, 0, wxALIGN_CENTER | wxALL, 0); WxBoxSizer6 = new wxBoxSizer(wxVERTICAL); WxBoxSizer4->Add(WxBoxSizer6, 0, wxALIGN_CENTER | wxALL, 5); WxStaticText1 = new wxStaticText(this, ID_WXSTATICTEXT1, _("Associated File Types:"), wxPoint(10, 5), wxDefaultSize, 0, _("WxStaticText1")); WxStaticText1->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer6->Add(WxStaticText1,0,wxALIGN_CENTER | wxALL,5); wxArrayString arrayStringFor_WxListBoxAssociated; WxListBoxAssociated = new wxListBox(this, ID_WXLISTBOXASSOCIATED, wxPoint(5, 32), wxSize(121, 200), arrayStringFor_WxListBoxAssociated, wxLB_EXTENDED); WxListBoxAssociated->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer6->Add(WxListBoxAssociated,0,wxALIGN_CENTER | wxALL,5); WxBoxSizer7 = new wxBoxSizer(wxVERTICAL); WxBoxSizer4->Add(WxBoxSizer7, 0, wxALIGN_CENTER | wxALL, 5); WxButtonAdd = new wxButton(this, ID_WXBUTTONADD, _("<- Add"), wxPoint(5, 5), wxSize(100, 30), 0, wxDefaultValidator, _("WxButtonAdd")); WxButtonAdd->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer7->Add(WxButtonAdd,0,wxALIGN_CENTER | wxALL,5); WxButtonRemove = new wxButton(this, ID_WXBUTTONREMOVE, _("Remove ->"), wxPoint(5, 45), wxSize(100, 30), 0, wxDefaultValidator, _("WxButtonRemove")); WxButtonRemove->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer7->Add(WxButtonRemove,0,wxALIGN_CENTER | wxALL,5); WxBoxSizer8 = new wxBoxSizer(wxVERTICAL); WxBoxSizer4->Add(WxBoxSizer8, 0, wxALIGN_CENTER | wxALL, 5); WxStaticText2 = new wxStaticText(this, ID_WXSTATICTEXT2, _("Predefined File Types:"), wxPoint(11, 5), wxDefaultSize, 0, _("WxStaticText2")); WxStaticText2->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer8->Add(WxStaticText2,0,wxALIGN_CENTER | wxALL,5); wxArrayString arrayStringFor_WxListBoxPredefined; WxListBoxPredefined = new wxListBox(this, ID_WXLISTBOXPREDEFINED, wxPoint(5, 32), wxSize(121, 200), arrayStringFor_WxListBoxPredefined, wxLB_EXTENDED); WxListBoxPredefined->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer8->Add(WxListBoxPredefined,0,wxALIGN_CENTER | wxALL,5); WxBoxSizer5 = new wxBoxSizer(wxHORIZONTAL); WxBoxSizer2->Add(WxBoxSizer5, 0, wxALIGN_LEFT | wxALL, 5); WxEditCustomType = new wxTextCtrl(this, ID_WXEDITCUSTOMTYPE, _(""), wxPoint(5, 5), wxSize(121, 30), 0, wxDefaultValidator, _("WxEditCustomType")); WxEditCustomType->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer5->Add(WxEditCustomType,0,wxALIGN_LEFT | wxALL,5); WxButtonAddCustom = new wxButton(this, ID_WXBUTTONADDCUSTOM, _("<- Add Custom File Type"), wxPoint(136, 5), wxSize(175, 30), 0, wxDefaultValidator, _("WxButtonAddCustom")); WxButtonAddCustom->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer5->Add(WxButtonAddCustom,0,wxALIGN_LEFT | wxALL,5); WxBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); WxBoxSizer1->Add(WxBoxSizer3, 0, wxALIGN_CENTER | wxALL, 5); WxButtonOK = new wxButton(this, ID_WXBUTTONOK, _("&OK"), wxPoint(14, 5), wxSize(85, 30), 0, wxDefaultValidator, _("WxButtonOK")); WxButtonOK->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer3->Add(WxButtonOK,0,wxALIGN_CENTER | wxALL,5); WxButtonCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"), wxPoint(100, 5), wxSize(90, 30), 0, wxDefaultValidator, _("WxButtonCancel")); WxButtonCancel->SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, _("MS Sans Serif"))); WxBoxSizer3->Add(WxButtonCancel,0,wxALIGN_CENTER | wxALL,5); SetTitle(_("File Type Associations")); SetIcon(wxNullIcon); GetSizer()->Layout(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); Center(); ////GUI Items Creation End //restore wxFont #undef wxFont wxArrayString as_predefined(g_PredefinedTypes_Count, g_PredefinedTypes); wxConfigBase *cfg=wxConfigBase::Get(false); wxString oldpath=cfg->GetPath(); cfg->SetPath(wxT("/AssociatedFileTypes")); int idx=0, idx2; wxString type; while(cfg->Read(wxString()<<idx, &type)) { if(DetectType(type)) { WxListBoxAssociated->Append(type); if((idx2=as_predefined.Index(type.c_str()))!=wxNOT_FOUND) { as_predefined.RemoveAt(idx2); } } ++idx; } WxListBoxPredefined->Set(as_predefined); cfg->SetPath(oldpath); ResizeItem(WxBoxSizer6, WxStaticText1, 2, 2); ResizeItem(WxBoxSizer8, WxStaticText2, 2, 2); SetDefaultItem(WxButtonCancel); WxButtonCancel->SetFocus(); }