Index: setup/choose.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/choose.cc,v retrieving revision 2.142 diff -u -p -r2.142 choose.cc --- setup/choose.cc 9 Sep 2005 19:52:51 -0000 2.142 +++ setup/choose.cc 13 Nov 2005 16:22:32 -0000 @@ -58,6 +58,8 @@ static const char *cvsid = #include "ControlAdjuster.h" #include "prereq.h" +#include "UserSettings.h" + using namespace std; extern ThreeBarProgressPage Progress; @@ -78,6 +80,39 @@ static ControlAdjuster::ControlInfo Choo {0, CP_LEFT, CP_TOP} }; +static ViewSetting ChosenView; + +void +ViewSetting::load() +{ + value = PickView::views::Category; + io_stream *f = UserSettings::Instance().settingFileForLoad("last-view"); + if (f) + { + char view[1000]; + if (f->gets (view, 1000)) + { + while (String (value.caption()) != String (view) && + ++value != PickView::views::Category) ; // Do nothing + } + delete f; + } + log (LOG_PLAIN) << "Loaded last view setting: " << value.caption() << endLog; +} + +void +ViewSetting::save() +{ + io_stream *f = UserSettings::Instance().settingFileForSave("last-view"); + if (f) + { + f->write ((String(value.caption()) + "\n").c_str(), + strlen (value.caption()) + 1); + delete f; + log (LOG_PLAIN) << "Saved last view setting: " << value.caption() << endLog; + } +} + ChooserPage::ChooserPage () { sizeProcessor.AddControlInfo (ChooserControlsInfo); @@ -92,11 +127,11 @@ ChooserPage::createListview () if (!chooser->Create(this, WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,&r)) // TODO throw exception exit (11); - chooser->init(PickView::views::Category); + chooser->init(ChosenView.value); chooser->Show(SW_SHOW); chooser->defaultTrust (TRUST_CURR); - chooser->setViewMode (PickView::views::Category); + chooser->setViewMode (ChosenView.value); if (!SetDlgItemText (GetHWND (), IDC_CHOOSE_VIEWCAPTION, chooser->mode_caption ())) log (LOG_BABBLE) << "Failed to set View button caption %ld" << GetLastError () << endLog; @@ -193,6 +228,10 @@ ChooserPage::OnNext () logResults(); #endif + ChosenView.value = PickView::views::Category; + while (String (ChosenView.value.caption()) != String (chooser->mode_caption()) && + ++ChosenView.value != PickView::views::Category) ; // Do nothing + PrereqChecker p; if (p.isMet ()) { Index: setup/choose.h =================================================================== RCS file: /cvs/cygwin-apps/setup/choose.h,v retrieving revision 2.36 diff -u -p -r2.36 choose.h --- setup/choose.h 21 May 2005 23:04:02 -0000 2.36 +++ setup/choose.h 13 Nov 2005 16:22:33 -0000 @@ -55,4 +55,13 @@ public: PickView *chooser; }; +#include "UserSetting.h" +class ViewSetting : public UserSetting +{ + public: + PickView::views value; + virtual void load(); + virtual void save(); +}; + #endif /* SETUP_CHOOSE_H */