OSDN Git Service

wxFileConfigをMainFrameのメンバとして残しておくよう変更。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Fri, 23 Oct 2009 11:58:15 +0000 (11:58 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Fri, 23 Oct 2009 11:58:15 +0000 (11:58 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@74 9df91469-1e22-0410-86e7-ea8537beb833

src/frontend/frm_main.cpp
src/frontend/frm_main.h

index 1a530ea..f15745e 100644 (file)
@@ -27,7 +27,6 @@
 #include "dlg_process.h"
 #include "functions.h"
 
-#include <wx/fileconf.h>
 #include <wx/arrimpl.cpp>
 
 WX_DEFINE_OBJARRAY(ArrayTPI_FILEINFO);
@@ -46,7 +45,7 @@ bool g_fSortAscend;
 // MainFrame
 //******************************************************************************
 
-MainFrame::MainFrame(): wxFrame()
+MainFrame::MainFrame(): conf(wxEmptyString, wxEmptyString, FE_DIR_BIN wxT("frontend.conf"), wxEmptyString, wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH), wxFrame()
 {
 }
 
@@ -56,40 +55,39 @@ MainFrame::~MainFrame()
        this->OnArcClose(e);
 
        // \90Ý\92è\82ð\8bL\98^\81B
-       wxFileConfig fc(wxEmptyString, wxEmptyString, ::wxGetCwd() + wxT("/frontend.conf"), wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
        if (! this->IsIconized() && ! this->IsMaximized())
        {
                int a, b;
                this->GetSize(& a, & b);
-               fc.Write(wxT("Window-Width"), a);
-               fc.Write(wxT("Window-Height"), b);
+               this->conf.Write(wxT("Window-Width"), a);
+               this->conf.Write(wxT("Window-Height"), b);
                this->GetPosition(& a, & b);
-               fc.Write(wxT("Window-X"), a);
-               fc.Write(wxT("Window-Y"), b);
+               this->conf.Write(wxT("Window-X"), a);
+               this->conf.Write(wxT("Window-Y"), b);
        }
-       fc.Write(wxT("Splitter-Pos"), this->window_splitter->GetSashPosition());
-       fc.Write(wxT("LastOpenPath"), this->fnLastOpenPath.GetFullPath());
+       this->conf.Write(wxT("Splitter-Pos"), this->window_splitter->GetSashPosition());
+       this->conf.Write(wxT("LastOpenPath"), this->fnLastOpenPath.GetFullPath());
 
        // \83c\81[\83\8b\83o\81[/\83X\83e\81[\83^\83X\83o\81[\8aÖ\98A\81B
-       fc.Write(wxT("StatusBar-Show"), this->statusbar->IsShown());
-       fc.Write(wxT("ToolBar-Show"),   this->toolbar->IsShown());
+       this->conf.Write(wxT("StatusBar-Show"), this->statusbar->IsShown());
+       this->conf.Write(wxT("ToolBar-Show"),   this->toolbar->IsShown());
 
        // ListView\8aÖ\98A\81B
-       fc.Write(wxT("ListView-IconMode"), this->menubar->IsChecked(XRCID("Exe_View_Icons")) ? 1 : this->menubar->IsChecked(XRCID("Exe_View_List")) ? 2 : 0);
+       this->conf.Write(wxT("ListView-IconMode"), this->menubar->IsChecked(XRCID("Exe_View_Icons")) ? 1 : this->menubar->IsChecked(XRCID("Exe_View_List")) ? 2 : 0);
        if (this->menubar->IsChecked(XRCID("Exe_View_Details")))
        {
-               fc.Write(wxT("ListView-C-Filename"), this->list_ctrl->GetColumnWidth(0));
-               fc.Write(wxT("ListView-C-Unpacked"), this->list_ctrl->GetColumnWidth(1));
-               fc.Write(wxT("ListView-C-Packed"), this->list_ctrl->GetColumnWidth(2));
-               fc.Write(wxT("ListView-C-Ratio"), this->list_ctrl->GetColumnWidth(3));
-               fc.Write(wxT("ListView-C-Method"), this->list_ctrl->GetColumnWidth(4));
-               fc.Write(wxT("ListView-C-Attr"), this->list_ctrl->GetColumnWidth(5));
-               fc.Write(wxT("ListView-C-Lastmodified"), this->list_ctrl->GetColumnWidth(6));
-               fc.Write(wxT("ListView-C-Path"), this->list_ctrl->GetColumnWidth(7));
-               fc.Write(wxT("ListView-C-Type"), this->list_ctrl->GetColumnWidth(8));
-               fc.Write(wxT("ListView-C-No"), this->list_ctrl->GetColumnWidth(9));
-               fc.Write(wxT("ListView-SortColumn"), g_nSortColumn);
-               fc.Write(wxT("ListView-SortAscend"), g_fSortAscend);
+               this->conf.Write(wxT("ListView-C-Filename"), this->list_ctrl->GetColumnWidth(0));
+               this->conf.Write(wxT("ListView-C-Unpacked"), this->list_ctrl->GetColumnWidth(1));
+               this->conf.Write(wxT("ListView-C-Packed"), this->list_ctrl->GetColumnWidth(2));
+               this->conf.Write(wxT("ListView-C-Ratio"), this->list_ctrl->GetColumnWidth(3));
+               this->conf.Write(wxT("ListView-C-Method"), this->list_ctrl->GetColumnWidth(4));
+               this->conf.Write(wxT("ListView-C-Attr"), this->list_ctrl->GetColumnWidth(5));
+               this->conf.Write(wxT("ListView-C-Lastmodified"), this->list_ctrl->GetColumnWidth(6));
+               this->conf.Write(wxT("ListView-C-Path"), this->list_ctrl->GetColumnWidth(7));
+               this->conf.Write(wxT("ListView-C-Type"), this->list_ctrl->GetColumnWidth(8));
+               this->conf.Write(wxT("ListView-C-No"), this->list_ctrl->GetColumnWidth(9));
+               this->conf.Write(wxT("ListView-SortColumn"), g_nSortColumn);
+               this->conf.Write(wxT("ListView-SortAscend"), g_fSortAscend);
        }
 
        this->Close(true);
@@ -145,9 +143,8 @@ void MainFrame::OnInit(wxInitDialogEvent&)
        this->tcFilter  = XRCCTRL(* this->toolbar, "tcFilter", wxTextCtrl);
 
        // \90Ý\92è\82ð\93Ç\82Ý\8d\9e\82Ý\81B
-       wxFileConfig fc(wxEmptyString, wxEmptyString, ::wxGetCwd() + wxT("/frontend.conf"), wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
-       this->SetSize(fc.Read(wxT("Window-X"), 0l), fc.Read(wxT("Window-Y"), 0l), fc.Read(wxT("Window-Width"), 800), fc.Read(wxT("Window-Height"), 400));
-       this->fnLastOpenPath = wxFileName::DirName(fc.Read(wxT("LastOpenPath"), ::wxGetCwd()));
+       this->SetSize(this->conf.Read(wxT("Window-X"), 0l), this->conf.Read(wxT("Window-Y"), 0l), this->conf.Read(wxT("Window-Width"), 800), this->conf.Read(wxT("Window-Height"), 400));
+       this->fnLastOpenPath = wxFileName::DirName(this->conf.Read(wxT("LastOpenPath"), ::wxGetCwd()));
        wxTheMimeTypesManager->Initialize(wxMAILCAP_ALL);
 
        // \8f\89\8aú\92l\90Ý\92è\81B
@@ -160,36 +157,36 @@ void MainFrame::OnInit(wxInitDialogEvent&)
        this->OnArcClose(e);
 
        // \83X\83v\83\8a\83b\83^\81[\90Ý\92è\81B
-       this->window_splitter->SetSashPosition(fc.Read(wxT("Splitter-Pos"), 200));
+       this->window_splitter->SetSashPosition(this->conf.Read(wxT("Splitter-Pos"), 200));
 
        // \83\8a\83X\83g\83r\83\85\81[\90Ý\92è\81B
-       int nIconMode = fc.Read(wxT("ListView-IconMode"), 0l);
+       int nIconMode = this->conf.Read(wxT("ListView-IconMode"), 0l);
        e.SetId(nIconMode == 1 ? XRCID("Exe_View_Icons") : (nIconMode == 2 ? XRCID("Exe_View_List") : XRCID("Exe_View_Details")));
        this->OnViewMode(e);
        // wxGTK\82Å\82Í\92¼\90ÚwxLC_VIRTUAL\82ð\8ew\92è\82µ\82È\82¢\82Æ\94½\89f\82³\82ê\82È\82¢\81B
        this->list_ctrl->SetSingleStyle(wxLC_VIRTUAL);
-       this->list_ctrl->InsertColumn(0, wxT("Filename"),      wxLIST_FORMAT_LEFT,   fc.Read(wxT("ListView-C-Filename"), 140));
-       this->list_ctrl->InsertColumn(1, wxT("Unpacked"),      wxLIST_FORMAT_RIGHT,  fc.Read(wxT("ListView-C-Unpacked"), 80));
-       this->list_ctrl->InsertColumn(2, wxT("Packed"),        wxLIST_FORMAT_RIGHT,  fc.Read(wxT("ListView-C-Packed"), 80));
-       this->list_ctrl->InsertColumn(3, wxT("Ratio"),         wxLIST_FORMAT_RIGHT,  fc.Read(wxT("ListView-C-Ratio"), 50));
-       this->list_ctrl->InsertColumn(4, wxT("Method"),        wxLIST_FORMAT_LEFT,   fc.Read(wxT("ListView-C-Method"), 60));
-       this->list_ctrl->InsertColumn(5, wxT("Attr"),          wxLIST_FORMAT_LEFT,   fc.Read(wxT("ListView-C-Attr"), 50));
-       this->list_ctrl->InsertColumn(6, wxT("Last modified"), wxLIST_FORMAT_RIGHT,  fc.Read(wxT("ListView-C-Lastmodified"), 150));
-       this->list_ctrl->InsertColumn(7, wxT("Path"),          wxLIST_FORMAT_LEFT,   fc.Read(wxT("ListView-C-Path"), 100));
-       this->list_ctrl->InsertColumn(8, wxT("Type"),          wxLIST_FORMAT_LEFT,   fc.Read(wxT("ListView-C-Type"), 100));
-       this->list_ctrl->InsertColumn(9, wxT("No."),           wxLIST_FORMAT_RIGHT,  fc.Read(wxT("ListView-C-No"), 35));
-       g_nSortColumn = fc.Read(wxT("ListView-SortColumn"), 9);
-       g_fSortAscend = fc.Read(wxT("ListView-SortAscend"), 1) == 1;
+       this->list_ctrl->InsertColumn(0, wxT("Filename"),      wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Filename"), 140));
+       this->list_ctrl->InsertColumn(1, wxT("Unpacked"),      wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Unpacked"), 80));
+       this->list_ctrl->InsertColumn(2, wxT("Packed"),        wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Packed"), 80));
+       this->list_ctrl->InsertColumn(3, wxT("Ratio"),         wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Ratio"), 50));
+       this->list_ctrl->InsertColumn(4, wxT("Method"),        wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Method"), 60));
+       this->list_ctrl->InsertColumn(5, wxT("Attr"),          wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Attr"), 50));
+       this->list_ctrl->InsertColumn(6, wxT("Last modified"), wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-Lastmodified"), 150));
+       this->list_ctrl->InsertColumn(7, wxT("Path"),          wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Path"), 100));
+       this->list_ctrl->InsertColumn(8, wxT("Type"),          wxLIST_FORMAT_LEFT,   this->conf.Read(wxT("ListView-C-Type"), 100));
+       this->list_ctrl->InsertColumn(9, wxT("No."),           wxLIST_FORMAT_RIGHT,  this->conf.Read(wxT("ListView-C-No"), 35));
+       g_nSortColumn = this->conf.Read(wxT("ListView-SortColumn"), 9);
+       g_fSortAscend = this->conf.Read(wxT("ListView-SortAscend"), 1) == 1;
        this->list_ctrl->SetDropTarget(new myFileDropTarget(this));
 
        // \83c\81[\83\8b\83o\81[/\83X\83e\81[\83^\83X\83o\81[\90Ý\92è\81B
        int nStatusBarParts[] = {70, 70, 180, 50, -1};
        this->statusbar->SetFieldsCount(5, nStatusBarParts);
        this->SetStatusBarPane(-1);
-       bool fShow = fc.Read(wxT("StatusBar-Show"), 1) == 1;
+       bool fShow = this->conf.Read(wxT("StatusBar-Show"), 1) == 1;
        this->menubar->Check(XRCID("Exe_View_StatusBar"), fShow);
        this->statusbar->Show(fShow);
-       fShow = fc.Read(wxT("ToolBar-Show"), 1) == 1;
+       fShow = this->conf.Read(wxT("ToolBar-Show"), 1) == 1;
        this->menubar->Check(XRCID("Exe_View_ToolBar"), fShow);
        this->toolbar->Show(fShow);
 
index cdc5313..72cbd31 100644 (file)
@@ -21,6 +21,7 @@
 \r
 #include <wx/cmdline.h>\r
 #include <wx/splitter.h>\r
+#include <wx/fileconf.h>
 \r
 #ifndef H_LOADED_FRM_MAIN\r
 #define H_LOADED_FRM_MAIN\r
@@ -77,6 +78,7 @@ protected:
     wxToolBar* toolbar;\r
     wxSplitterWindow* window_splitter;\r
     wxTextCtrl * tcFilter;\r
+       wxFileConfig conf;\r
     DECLARE_EVENT_TABLE()\r
 };\r
 \r