コード例 #1
0
ファイル: SettingsViews.cpp プロジェクト: AmirAbrams/haiku
void
SpaceBarSettingsView::SetDefaults()
{
	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
	if (tracker == NULL)
		return;

	TrackerSettings settings;

	if (!settings.ShowVolumeSpaceBar()) {
		settings.SetShowVolumeSpaceBar(true);
		send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar", true);
	}

	if (settings.UsedSpaceColor() != kDefaultUsedSpaceColor
		|| settings.FreeSpaceColor() != kDefaultFreeSpaceColor
		|| settings.WarningSpaceColor() != kDefaultWarningSpaceColor) {
		settings.SetUsedSpaceColor(kDefaultUsedSpaceColor);
		settings.SetFreeSpaceColor(kDefaultFreeSpaceColor);
		settings.SetWarningSpaceColor(kDefaultWarningSpaceColor);
		tracker->SendNotices(kSpaceBarColorChanged);
	}

	ShowCurrentSettings();
}
コード例 #2
0
ファイル: SettingsViews.cpp プロジェクト: AmirAbrams/haiku
void
SpaceBarSettingsView::Revert()
{
	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
	if (tracker == NULL)
		return;

	TrackerSettings settings;

	if (settings.ShowVolumeSpaceBar() != fSpaceBarShow) {
		settings.SetShowVolumeSpaceBar(fSpaceBarShow);
		send_bool_notices(kShowVolumeSpaceBar, "ShowVolumeSpaceBar",
			fSpaceBarShow);
	}

	if (settings.UsedSpaceColor() != fUsedSpaceColor
		|| settings.FreeSpaceColor() != fFreeSpaceColor
		|| settings.WarningSpaceColor() != fWarningSpaceColor) {
		settings.SetUsedSpaceColor(fUsedSpaceColor);
		settings.SetFreeSpaceColor(fFreeSpaceColor);
		settings.SetWarningSpaceColor(fWarningSpaceColor);
		tracker->SendNotices(kSpaceBarColorChanged);
	}

	ShowCurrentSettings();
}
コード例 #3
0
ファイル: SettingsViews.cpp プロジェクト: RTOSkit/haiku
void
TrashSettingsView::Revert()
{
	TrackerSettings settings;

	settings.SetDontMoveFilesToTrash(fDontMoveFilesToTrash);
	settings.SetAskBeforeDeleteFile(fAskBeforeDeleteFile);

	ShowCurrentSettings();
	_SendNotices();
}
コード例 #4
0
ファイル: SettingsViews.cpp プロジェクト: RTOSkit/haiku
void
TrashSettingsView::SetDefaults()
{
	TrackerSettings settings;

	settings.SetDontMoveFilesToTrash(false);
	settings.SetAskBeforeDeleteFile(true);

	ShowCurrentSettings();
	_SendNotices();
}
コード例 #5
0
ファイル: SettingsViews.cpp プロジェクト: mariuz/haiku
void
TimeFormatSettingsView::Revert()
{
	TrackerSettings settings;

	settings.SetTimeFormatSeparator(fSeparator);
	settings.SetDateOrderFormat(fFormat);
	settings.SetClockTo24Hr(f24HrClock);

	ShowCurrentSettings();
	_SendNotices();
}
コード例 #6
0
ファイル: SettingsViews.cpp プロジェクト: mariuz/haiku
void
TimeFormatSettingsView::SetDefaults()
{
	TrackerSettings settings;

	settings.SetTimeFormatSeparator(kSlashSeparator);
	settings.SetDateOrderFormat(kMDYFormat);
	settings.SetClockTo24Hr(false);

	ShowCurrentSettings();
	_SendNotices();
}
コード例 #7
0
ファイル: SettingsViews.cpp プロジェクト: AmirAbrams/haiku
void
DesktopSettingsView::Revert()
{
	TrackerSettings settings;

	settings.SetShowDisksIcon(fShowDisksIcon);
	settings.SetMountVolumesOntoDesktop(fMountVolumesOntoDesktop);
	settings.SetMountSharedVolumesOntoDesktop(fMountSharedVolumesOntoDesktop);
	settings.SetEjectWhenUnmounting(fEjectWhenUnmounting);

	ShowCurrentSettings();
	_SendNotices();
}
コード例 #8
0
ファイル: SettingsViews.cpp プロジェクト: AmirAbrams/haiku
void
WindowsSettingsView::Revert()
{
	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
	if (tracker == NULL)
		return;

	TrackerSettings settings;

	if (settings.ShowFullPathInTitleBar() != fShowFullPathInTitleBar) {
		settings.SetShowFullPathInTitleBar(fShowFullPathInTitleBar);
		tracker->SendNotices(kWindowsShowFullPathChanged);
	}

	if (settings.SingleWindowBrowse() != fSingleWindowBrowse) {
		settings.SetSingleWindowBrowse(fSingleWindowBrowse);
		tracker->SendNotices(kSingleWindowBrowseChanged);
	}

	if (settings.ShowNavigator() != fShowNavigator) {
		settings.SetShowNavigator(fShowNavigator);
		tracker->SendNotices(kShowNavigatorChanged);
	}

	if (settings.TransparentSelection() != fTransparentSelection) {
		settings.SetTransparentSelection(fTransparentSelection);
		send_bool_notices(kTransparentSelectionChanged,
			"TransparentSelection", fTransparentSelection);
	}

	if (settings.SortFolderNamesFirst() != fSortFolderNamesFirst) {
		settings.SetSortFolderNamesFirst(fSortFolderNamesFirst);
		send_bool_notices(kSortFolderNamesFirstChanged,
			"SortFolderNamesFirst", fSortFolderNamesFirst);
	}

	if (settings.HideDotFiles() != fHideDotFiles) {
		settings.SetSortFolderNamesFirst(fHideDotFiles);
		send_bool_notices(kHideDotFilesChanged,
			"HideDotFiles", fHideDotFiles);
	}

	if (settings.TypeAheadFiltering() != fTypeAheadFiltering) {
		settings.SetTypeAheadFiltering(fTypeAheadFiltering);
		send_bool_notices(kTypeAheadFilteringChanged,
			"TypeAheadFiltering", fTypeAheadFiltering);
	}

	ShowCurrentSettings();
}
コード例 #9
0
ファイル: SettingsViews.cpp プロジェクト: AmirAbrams/haiku
void
DesktopSettingsView::SetDefaults()
{
	// ToDo: Avoid the duplication of the default values.
	TrackerSettings settings;

	settings.SetShowDisksIcon(false);
	settings.SetMountVolumesOntoDesktop(true);
	settings.SetMountSharedVolumesOntoDesktop(true);
	settings.SetEjectWhenUnmounting(true);

	ShowCurrentSettings();
	_SendNotices();
}
コード例 #10
0
ファイル: SettingsViews.cpp プロジェクト: RTOSkit/haiku
void
WindowsSettingsView::SetDefaults()
{
	TTracker* tracker = dynamic_cast<TTracker*>(be_app);
	if (!tracker)
		return;

	TrackerSettings settings;

	if (settings.ShowFullPathInTitleBar()) {
		settings.SetShowFullPathInTitleBar(false);
		tracker->SendNotices(kWindowsShowFullPathChanged);
	}

	if (settings.SingleWindowBrowse()) {
		settings.SetSingleWindowBrowse(false);
		tracker->SendNotices(kSingleWindowBrowseChanged);
	}

	if (settings.ShowNavigator()) {
		settings.SetShowNavigator(false);
		tracker->SendNotices(kShowNavigatorChanged);
	}

	if (!settings.TransparentSelection()) {
		settings.SetTransparentSelection(true);
		send_bool_notices(kTransparentSelectionChanged,
			"TransparentSelection", true);
	}

	if (!settings.SortFolderNamesFirst()) {
		settings.SetSortFolderNamesFirst(true);
		send_bool_notices(kSortFolderNamesFirstChanged,
			"SortFolderNamesFirst", true);
	}

	if (settings.TypeAheadFiltering()) {
		settings.SetTypeAheadFiltering(false);
		send_bool_notices(kTypeAheadFilteringChanged,
			"TypeAheadFiltering", true);
	}

	ShowCurrentSettings();
}
コード例 #11
0
ファイル: DialogGrid.cpp プロジェクト: yestein/dream-of-idle
//------------------------------------------------------------------------
DialogGrid::DialogGrid( wxWindow* parent): 
m_visible(wx_static_cast(wxCheckBox*, NULL)),
m_snapModeChoice(wx_static_cast(wxRadioBox*, NULL)),
m_size(wx_static_cast(wxTextCtrl*, NULL)),
wxDialog(parent, wxID_ANY, wxT("Grid settings"), wxDefaultPosition, wxSize(300, 255))
{

    // NOTE: Prefer constructor initialization lists (which are 
    // often more efficient) to assignment inside the 
    // constructor. Members in the initialization list should 
    // appear in the order they are declared in the class, as 
    // this is the order they will be initialized (no matter what).
    // See item 4 in 'Effective C++ 3rd Edition' by Scott Meyers

    // Initialize dialog
    Setup();
}

//-----------------------------------------------------------------------
void DialogGrid::Setup()
{
    // Add the dialog's controls
    wxStaticBox* const mainGroup = new wxStaticBox(this, wxID_ANY, wxT("Update settings:"));
    m_visible = new wxCheckBox(this, wxID_ANY, wxT("grid visible") );

    // Snap options
    const wxString options[] = {wxT("Snap X"), wxT("Snap Y"), wxT("Snap both")};
    m_snapModeChoice = new wxRadioBox(this, wxID_ANY, wxT("Snap mode:"), wxDefaultPosition, wxDefaultSize, 3, options);

    wxStaticText* const size = new wxStaticText(this, wxID_ANY, wxT("Size in pixels:") );
    // Validate for positive number
    m_size = new wxTextCtrl(this, wxID_ANY);

    wxButton* const ok = new wxButton(this, ID_OK_BUTTON, wxT("&OK") );
    wxButton* const cancel = new wxButton(this, ID_CANCEL_BUTTON, wxT("&Cancel") );

    // Mark 'OK' button as the default one (i.e. activated when user presses enter)
    ok->SetDefault();

    // Layout the dialog vertically
    wxBoxSizer* const rootSizer = new wxBoxSizer(wxVERTICAL);

    // Put components -except for the buttons- inside a group
    // NOTE: No need to free the custodial pointer mainGroup 
    // since it will be handled internally by wxWidgets wxStaticBoxSizer::wxStaticBoxSizer()
    wxStaticBoxSizer* const settingsSizer = new wxStaticBoxSizer(mainGroup, wxVERTICAL);

    // These use entire row
    (void)settingsSizer->Add(m_visible, 0, wxALL, BORDER);
    (void)settingsSizer->Add(m_snapModeChoice, 0, wxALL, BORDER);

    // These components share one row
    // NOTE: No need to free the custodial pointers size, visibleSizer 
    // and settingsSizer since they will be handled internally by 
    // wxWidgets wxSizer::Add()
    wxBoxSizer* const visibleSizer = new wxBoxSizer(wxHORIZONTAL);
    (void)visibleSizer->Add(size, 1, wxALL, BORDER); // within their space, they may stretch
    (void)visibleSizer->Add(m_size, 1, wxALL, BORDER);
    (void)settingsSizer->Add(visibleSizer, 0, wxEXPAND | wxALL, BORDER);
    (void)rootSizer->Add(settingsSizer, 1, wxEXPAND | wxALL, BORDER);

    // The buttons share one row as well
    // NOTE: No need to free the custodial pointers ok, cancel and buttonSizer 
    // since they will be handled internally by wxWidgets wxSizer::Add()
    wxBoxSizer* const buttonSizer = new wxBoxSizer(wxHORIZONTAL);
    (void)buttonSizer->Add(ok, 0, wxALL, BORDER);
    (void)buttonSizer->Add(cancel, 0, wxALL, BORDER);
    (void)rootSizer->Add(buttonSizer, 0, wxEXPAND | wxALL, BORDER);

    // Apply root sizer
    // NOTE: No need to free the custodial pointer rootSizer 
    // since it will be handled internally by wxWidgets wxWindowBase::SetSizer()
    SetSizer(rootSizer);

    // Represent current settings
    ShowCurrentSettings();

    // Center dialog
    Centre();
}