Exemplo n.º 1
0
CDialogVolumeAddNew::CDialogVolumeAddNew(
    CVolumes *pVolumes,
    wxWindow *parent) :
    wxDialog(parent,wxID_ANY,"Create New " VOLUME_STRING,
             wxDefaultPosition, wxDefaultSize,
             mainApp::DIALOG_STYLE
            ),
    m_pVolumes(pVolumes)
{

    const wxArrayString &as(pVolumes->GetVolumeNames());
    wxBoxSizer *pSizer1 = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *pSizer = new wxBoxSizer(wxVERTICAL);

    m_pChoiceKit = new wxChoice(
        this,wxID_ANY,wxDefaultPosition,wxDefaultSize,
        as);

    m_pText = new wxTextCtrl(this,wxID_ANY,wxEmptyString,
                             wxDefaultPosition, wxSize(100,-1),wxTE_LEFT);
    pSizer1->Add(
        new wxStaticText(this,wxID_ANY,"Select " aVolume_string " to copy:"),
        0,wxALIGN_LEFT,0);
    pSizer1->Add(m_pChoiceKit,0,wxEXPAND | wxBOTTOM,ID_BORDER);
    pSizer1->Add(
        new wxStaticText(this,wxID_ANY,"Enter " Volume_string " name:"),
        0,wxALIGN_LEFT,0);
    pSizer1->Add(m_pText,0,wxEXPAND,0);
    pSizer1->AddStretchSpacer(1);
    pSizer->Add(pSizer1, 1, (wxALL ^ wxBOTTOM) | wxEXPAND, ID_BORDER);
    pSizer->Add(
        CreateButtonSizer(wxOK | wxCANCEL),
        0, wxALIGN_CENTER | wxALL, ID_BORDER);
    SetMinSize(wxSize(250,10));
    SetSizer(pSizer);
    Layout();
    Fit();
    CentreOnParent();
}
Exemplo n.º 2
0
void AssistPanel::AdjustSize(wxSize& s)
{
    SetSize(s);
    SetMinSize(s);
    SetMaxSize(s);

	if( mGridCanvas != nullptr )
    {
        mGridCanvas->AdjustSize(s);
        mGridCanvas->Refresh();
    }

    ScrolledWindowAssist->SetSize(s);
    ScrolledWindowAssist->SetMinSize(s);
    ScrolledWindowAssist->SetMaxSize(s);

    ScrolledWindowAssist->FitInside();
    ScrolledWindowAssist->SetScrollRate(5, 5);
    ScrolledWindowAssist->Refresh();

    Refresh();
}
Exemplo n.º 3
0
pxStaticText &pxStaticText::WrapAt(int width)
{
    m_autowrap = false;

    if ((width <= 1) || (width == m_wrappedWidth))
        return *this;

    wxString wrappedLabel;
    m_wrappedWidth = width;

    if (width > 1)
        wrappedLabel = pxTextWrapper().Wrap(this, m_label, width).GetResult();

    if (m_wrappedLabel != wrappedLabel) {
        m_wrappedLabel = wrappedLabel;
        wxSize area = wxClientDC(this).GetMultiLineTextExtent(m_wrappedLabel);
        SetMinSize(wxSize(
            area.GetWidth() + calcPaddingWidth(area.GetWidth()),
            area.GetHeight() + calcPaddingHeight(area.GetHeight())));
    }
    return *this;
}
Exemplo n.º 4
0
    : wxOwnerDrawnComboBox(parent, id, wxEmptyString, wxDefaultPosition,
                           wxDefaultSize, wxArrayString(), wxCB_READONLY)
#endif
{
    // If the ctrl is too small the color box gets messed up in wxOSX
    SetMinSize(wxSize(GetCharWidth() * 22, -1));
    s_ctrls.push_back(this);
    // Make sure we have a list of colors
    if (s_colors.empty())
        InitColors();
    else
        UpdateCtrls();
    // Set the initial value
    SetColor(color.IsOk() ? color : *wxWHITE);
    // Connect the event handler
#ifndef __WXOSX__
    Connect(wxEVT_COMMAND_COMBOBOX_SELECTED,
#else
    Connect(wxEVT_COMMAND_CHOICE_SELECTED,
#endif
            wxCommandEventHandler(ColorChoice::OnSelection));
}
void wxsNewWindowDlg::OnAdvOpsClick(cb_unused wxCommandEvent& event)
{
    Freeze();
    m_AdvOpsShown = !m_AdvOpsShown;
    wxString BaseLabel = _("Advanced options");
    if ( m_AdvOpsShown )
    {
        m_RootSizer->Show(m_AdvancedOptionsSizer);
        m_AdvOps->SetLabel(_T("- ") + BaseLabel);
    }
    else
    {
        m_RootSizer->Hide(m_AdvancedOptionsSizer);
        m_AdvOps->SetLabel(_T("+ ") + BaseLabel);
    }
    SetMinSize(wxSize(10,10));
    SetSize(wxSize(10,10));
    Layout();
    m_RootSizer->Fit(this);
    m_RootSizer->SetSizeHints(this);
    Thaw();
}
Exemplo n.º 6
0
FbViewerDlg::FbViewerDlg( wxWindow* parent, const wxString& type, const wxString& value, bool relative)
	: FbDialog( parent, wxID_ANY, _("Customize"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER), m_coolreader(NULL), m_relative(relative)
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer* bSizerMain = new wxBoxSizer( wxVERTICAL );

	wxString msg = _("Select the application to view files") + COLON + type;
	wxStaticText* stTitle = new wxStaticText( this, wxID_ANY, msg, wxDefaultPosition, wxDefaultSize, 0 );
	stTitle->Wrap( -1 );
	bSizerMain->Add( stTitle, 0, wxALL, 5 );

	m_filename = new FbCustomCombo( this, ID_FILENAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
	m_filename->SetMinSize( wxSize( 300,-1 ) );
	bSizerMain->Add( m_filename, 0, wxALL|wxEXPAND, 5 );

	#ifdef FB_INCLUDE_READER
	m_coolreader = new wxCheckBox( this, ID_COOLREADER, _("Use builtin CoolReader3"));
	bSizerMain->Add( m_coolreader, 0, wxEXPAND|wxALL, 5 );
	#endif // FB_INCLUDE_READER

	if (value == wxT('*')) {
		if (m_coolreader) m_coolreader->SetValue(true);
	} else {
		m_filename->SetValue(value);
	}

	wxStdDialogButtonSizer * sdbSizerBtn = CreateStdDialogButtonSizer( wxOK | wxCANCEL );
	bSizerMain->Add( sdbSizerBtn, 0, wxEXPAND | wxALL, 5 );

	SetSizer( bSizerMain );
	Layout();
	bSizerMain->Fit( this );
	m_filename->SetFocus();

	wxSize size = GetBestSize();
	SetMaxSize(wxSize(-1, size.y));
	SetMinSize(size);
}
Exemplo n.º 7
0
void AnnunText::CalculateMinSize(void)
{
            //    Calculate the minimum required size of the window based on text size

      int wl = 50;            // reasonable defaults?
      int hl = 20;
      int wv = 50;
      int hv = 20;

      if(m_plabelFont)
            GetTextExtent(_T("1234"), &wl, &hl, NULL, NULL, m_plabelFont);


      if(m_pvalueFont)
            GetTextExtent(_T("123.456"), &wv, &hv, NULL, NULL, m_pvalueFont);

      wxSize min;
      min.x = wl + wv;
      min.y = (int)((hl + hv) * 1.2);

      SetMinSize(min);
}
Exemplo n.º 8
0
FontFaceCtrl::FontFaceCtrl(wxWindow * parent, wxWindowID id,
                           const wxString & faceName)
    : wxComboBox(parent, id, wxEmptyString)
{
    SetMinSize(wxSize(GetCharWidth() * 22, -1));
    // Make sure we have a list of font faces
    if (! s_threadComplete)
        InitFacenames();

    // Set the first value
    if (faceName == wxEmptyString)
        SetValue(wxSWISS_FONT->GetFaceName());
    else
        SetValue(faceName);
    // Connect events
    Bind(wxEVT_KILL_FOCUS, &FontFaceCtrl::OnKillFocus, this);
    Bind(wxEVT_SET_FOCUS, &FontFaceCtrl::OnSetFocus, this);
    // I can't seem to get wxTE_PROCESS_ENTER and wxEVT_TEXT_ENTER to work,
    // so we'll circumvent that with a CHAR_HOOK event
    // Perhaps wxPropertySheetDialog is catching enter events?
    Bind(wxEVT_CHAR_HOOK, &FontFaceCtrl::OnCharHook, this);
}
Exemplo n.º 9
0
BoatDialog::BoatDialog(WeatherRouting &weatherrouting)
    : BoatDialogBase(&weatherrouting),
      m_WeatherRouting(weatherrouting), m_PlotScale(0), m_CrossOverRegenerate(false), m_CrossOverGenerationThread(NULL)
{
    // for small screens: don't let boat dialog be larger than screen
    int w,h;
    wxDisplaySize( &w, &h );
    w = wxMin(w, GetMinWidth());
    h = wxMin(h-32, GetMinHeight());
    SetMinSize(wxSize(w, h));
    SetSize(wxSize(w, h));

    m_lPolars->InsertColumn(spFILENAME, _("Filename"));

    wxFileConfig *pConf = GetOCPNConfigObject();
    pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) );

    m_orientation[0] = pConf->Read ( _T ( "Orientation0" ), 1L );
    m_orientation[1] = pConf->Read ( _T ( "Orientation1" ), 1L );

    // hack to adjust items
    SetSize(wxSize(w, h));
}
Exemplo n.º 10
0
void wxSTEditorFindReplaceDialog::OnButton(wxCommandEvent& event)
{
    switch (event.GetId())
    {
        case ID_STEDLG_FINDALL_CHECKBOX :
        {
            // wxWidgets needs help resizing the shown/hidden results editor
            //   This ugly hack works in any case
            //wxSize s = GetSize();
            //wxSize minSize = m_findReplacePanel->GetSize();
            //wxPrintf(wxT("DLG %d %d    %d %d\n"), s.GetWidth(), s.GetHeight(), minSize.GetWidth(), minSize.GetHeight());

            InvalidateBestSize();
            SetMinSize(wxSize(10,10));
            GetSizer()->SetMinSize(wxSize(10,10));
            m_findReplacePanel->GetSizer()->SetSizeHints(this);

            break;
        }
        case wxID_CANCEL : Destroy();
        default : event.Skip();
    }
}
Exemplo n.º 11
0
void MainWindow::initMainPanel()
{
  m_panel = new wxPanel(this, wxID_ANY);
  // m_panel->
  SetMinSize(wxSize(320, 240));

  // m_topsizer = new wxGridSizer(1);
  wxSizer * vsizer = new wxBoxSizer(wxVERTICAL);
  m_hsizer = new wxBoxSizer(wxHORIZONTAL);
  m_canvas =
      new Canvas(m_panel, wxID_ANY);
  vsizer->Add(m_canvas, 1,
              wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL // | wxEXPAND
              );
  m_hsizer->Add(vsizer, 1,
                wxALIGN_CENTER | wxALIGN_CENTER_HORIZONTAL);
  // m_hsizer->SetMinSize(wxSize(320,240));
  m_canvas->SetParentSizerPtr(m_hsizer);
  m_panel->SetSizer(m_hsizer);
  m_panel->SetAutoLayout(true);

  m_mgr.AddPane(m_panel, wxCENTER);
}
Exemplo n.º 12
0
void MixerToolBar::UpdatePrefs()
{
#if USE_PORTMIXER
   float inputVolume;
   float playbackVolume;
   int inputSource;

   wxArrayString inputSources = gAudioIO->GetInputSourceNames();

   // Repopulate the selections
   mInputSourceChoice->Clear();
   mInputSourceChoice->Append(inputSources);

   // Reset the selected source
   gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
   mInputSourceChoice->SetSelection(inputSource);

   // Resize the control
   mInputSourceChoice->SetSize(mInputSourceChoice->GetBestFittingSize());

   // Show or hide the control based on input sources
   mInputSourceChoice->Show( inputSources.GetCount() != 0 );

   // Layout the toolbar
   Layout();

   // Resize the toolbar to fit the contents
   Fit();

   // And make that size the minimum
   SetMinSize( wxWindow::GetSizer()->GetMinSize() );
   SetSize( GetMinSize() );

   // Notify someone that we've changed our size
   Updated();
#endif
}
Exemplo n.º 13
0
/** Compute and Set minimal size for the window
  * Minimal size will be the size with all panes unfolded
  * Override this function if another behaviour is desired
  */
void wxFoldPanelEx::ComputeDimensions(void)
{
    size_t i, iMax;
    wxFoldItemEx *f;
    wxSize sMinSize(0,0);
    wxSize sSize(0,0);

    iMax = GetCount();
    for(i=0;i<iMax;i++)
    {
        f = GetFoldItem(i);
        if (f)
        {
            sSize = f->GetBestSize();
            if (MainSizer) MainSizer->SetItemMinSize(f, sSize.GetWidth(), sSize.GetHeight());
        }
        else
        {
            sSize.SetWidth(0);
            sSize.SetHeight(0);
        }

        if (m_bVertical)
        {
            sMinSize.SetHeight(sMinSize.GetHeight() + sSize.GetHeight());
            if (sSize.GetWidth() > sMinSize.GetWidth()) sMinSize.SetWidth(sSize.GetWidth());
        }
        else
        {
            sMinSize.SetWidth(sMinSize.GetWidth() + sSize.GetWidth());
            if (sSize.GetHeight() > sMinSize.GetHeight()) sMinSize.SetHeight(sSize.GetHeight());
        }
    }

    SetMinSize(sMinSize);
    if (MainSizer) MainSizer->SetMinSize(sMinSize);
}
Exemplo n.º 14
0
void OptionPage::OptionFont(wxSizer *sizer, std::string opt_prefix) {
	const auto face_opt = OPT_GET(opt_prefix + "Font Face");
	const auto size_opt = OPT_GET(opt_prefix + "Font Size");

	parent->AddChangeableOption(face_opt->GetName());
	parent->AddChangeableOption(size_opt->GetName());

	auto font_name = new wxTextCtrl(this, -1, to_wx(face_opt->GetString()));
	font_name->SetMinSize(wxSize(160, -1));
	font_name->Bind(wxEVT_TEXT, StringUpdater(face_opt->GetName().c_str(), parent));

	auto font_size = new wxSpinCtrl(this, -1, std::to_wstring((int)size_opt->GetInt()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 42, size_opt->GetInt());
	font_size->Bind(wxEVT_SPINCTRL, IntUpdater(size_opt->GetName().c_str(), parent));

	auto pick_btn = new wxButton(this, -1, _("Choose..."));
	pick_btn->Bind(wxEVT_BUTTON, std::bind(font_button, parent, font_name, font_size));

	auto button_sizer = new wxBoxSizer(wxHORIZONTAL);
	button_sizer->Add(font_name, wxSizerFlags(1).Expand());
	button_sizer->Add(pick_btn, wxSizerFlags().Expand());

	Add(sizer, _("Font Face"), button_sizer);
	Add(sizer, _("Font Size"), font_size);
}
Exemplo n.º 15
0
settings_frame::settings_frame(wxWindow* parent, const wxString& title, wxWindowID id)
    : wxFrame(parent, id, title)
    , WindowAttributesPickle(_T("SETTINGSFRAME"), this, wxSize(DEFSETT_SW_WIDTH, DEFSETT_SW_HEIGHT))
    , simpleTab(0)
    , uiTab(0)
    , audioTab(0)
    , detailTab(0)
    , qualityTab(0)
    ,
    //	hotkeyTab(0),
    settingsIcon(new wxIcon(springsettings_xpm))
    , m_has_focus(true)
{
	SetMinSize(wxSize(DEFSETT_SW_WIDTH, DEFSETT_SW_HEIGHT));

	alreadyCalled = false;
	parentWindow = parent;

	notebook = new wxNotebook(this, ID_OPTIONS);
	//	notebook->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, _T("Tahoma")));


	if (abstract_panel::loadValuesIntoMap()) {
		CreateGUIControls();
		initMenuBar();
	}

	//Dialog just created, no setting were changed yet
	abstract_panel::settingsChanged = false;

	Layout();
	Center();

	if (!parentWindow)
		UpdateMainAppHasFocus(m_has_focus); // only do if not being a slave of main SL app
}
Exemplo n.º 16
0
ExportMultiple::ExportMultiple(AudacityProject *project)
: wxDialog(project, wxID_ANY, wxString(_("Export Multiple")))
{
   SetName(GetTitle());

   mProject = project;
   mTracks = project->GetTracks();
   // Construct an array of non-owning pointers
   for (const auto &plugin : mExporter.GetPlugins())
      mPlugins.push_back(plugin.get());

   this->CountTracksAndLabels();

   mBook = NULL;

   // create array of characters not allowed in file names
   wxString forbid = wxFileName::GetForbiddenChars();
   for(unsigned int i=0; i < forbid.Length(); i++)
      exclude.Add( forbid.Mid(i, 1) );

   ShuttleGui S(this, eIsCreatingFromPrefs);

   // Creating some of the widgets cause cause events to fire
   // and we don't want that until after we're completely
   // created.  (Observed on Windows)
   mInitialized = false;
   PopulateOrExchange(S);
   mInitialized = true;

   Layout();
   Fit();
   SetMinSize(GetSize());
   Center();

   EnableControls();
}
Exemplo n.º 17
0
void AboutDialog::on_dpi_changed(const wxRect &suggested_rect)
{
    m_logo_bitmap.msw_rescale();
    m_logo->SetBitmap(m_logo_bitmap.bmp());

    const wxFont& font = GetFont();
    const int fs = font.GetPointSize() - 1;
    int font_size[] = { fs, fs, fs, fs, fs, fs, fs };
    m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), font_size);

    const int& em = em_unit();

    msw_buttons_rescale(this, em, { wxID_CLOSE });

    m_html->SetMinSize(wxSize(-1, 16 * em));
    m_html->Refresh();

    const wxSize& size = wxSize(65 * em, 30 * em);

    SetMinSize(size);
    Fit();

    Refresh();
}
Exemplo n.º 18
0
void OptionsDlg2::Initialize()
{
    m_treeBook->AddPage(0, _("Editor"));
    AddSubPage(new EditorOptionsGeneralGuidesPanel(m_treeBook), _("Guides"), true);
    AddSubPage(new EditorOptionsGeneralEdit(m_treeBook), _("Edit"), false);
    AddSubPage(new EditorOptionsGeneralIndentationPanel(m_treeBook), _("Indentation"));
    AddSubPage(new EditorOptionsGeneralRightMarginPanel(m_treeBook), _("Right Margin Indicator"));
    AddSubPage(new EditorSettingsCaret(m_treeBook), _("Caret & Scrolling"));
    AddSubPage(new EditorOptionsGeneralSavePanel(m_treeBook), _("Save Options"));

    m_treeBook->AddPage(0, wxT("Tweaks"));
    AddSubPage(new EditorSettingsComments(m_treeBook), _("Code"));
    AddSubPage(new EditorSettingsCommentsDoxygenPanel(m_treeBook), _("Doxygen"));

    AddPage(new EditorSettingsFolding(m_treeBook), _("Folding"));
    AddPage(new EditorSettingsBookmarksPanel(m_treeBook), _("Bookmarks"));
    AddPage(new EditorSettingsDockingWindows(m_treeBook), _("Windows & Tabs"));

    // the Terminal page should NOT be added under Windows
    AddPage(new EditorSettingsTerminal(m_treeBook), _("Terminal"));
    AddPage(new EditorSettingsMiscPanel(m_treeBook), _("Misc"));

    SetMinSize(wxSize(300, 200));
}
Exemplo n.º 19
0
LLDBLocalsViewBase::LLDBLocalsViewBase(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
    : wxPanel(parent, id, pos, size, style)
{
    if ( !bBitmapLoaded ) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxCrafternz79PnInitBitmapResources();
        bBitmapLoaded = true;
    }
    
    wxBoxSizer* boxSizer67 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(boxSizer67);
    
    m_auibar199 = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxSize(-1,-1), wxAUI_TB_PLAIN_BACKGROUND|wxAUI_TB_DEFAULT_STYLE);
    m_auibar199->SetToolBitmapSize(wxSize(16,16));
    
    boxSizer67->Add(m_auibar199, 0, wxEXPAND, 5);
    
    m_auibar199->AddTool(wxID_NEW, _("Add Watch..."), wxArtProvider::GetBitmap(wxART_PLUS, wxART_TOOLBAR, wxSize(16, 16)), wxNullBitmap, wxITEM_NORMAL, _("Add Watch..."), _("Add Watch..."), NULL);
    
    m_auibar199->AddTool(wxID_DELETE, _("Delete Watch"), wxArtProvider::GetBitmap(wxART_DELETE, wxART_TOOLBAR, wxSize(16, 16)), wxNullBitmap, wxITEM_NORMAL, _("Delete Watch"), _("Delete Watch"), NULL);
    m_auibar199->Realize();
    
    SetName(wxT("LLDBLocalsViewBase"));
    SetMinSize( wxSize(200,200) );
    SetSizeHints(-1,-1);
    if ( GetSizer() ) {
         GetSizer()->Fit(this);
    }
    CentreOnParent(wxBOTH);
    // Connect events
    this->Connect(wxID_NEW, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(LLDBLocalsViewBase::OnNewWatch), NULL, this);
    this->Connect(wxID_DELETE, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(LLDBLocalsViewBase::OnDelete), NULL, this);
    this->Connect(wxID_DELETE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(LLDBLocalsViewBase::OnDeleteUI), NULL, this);
    
}
Exemplo n.º 20
0
ExportMultiple::ExportMultiple(AudacityProject *project)
: wxDialog(project, wxID_ANY, wxString(_("Export Multiple")))
{
   mProject = project;
   mTracks = project->GetTracks();
   mPlugins = mExporter.GetPlugins();

   ShuttleGui S(this, eIsCreatingFromPrefs);

   // Creating some of the widgets cause cause events to fire
   // and we don't want that until after we're completely
   // created.  (Observed on Windows)
   mInitialized = false;
   PopulateOrExchange(S);
   mInitialized = true;

   GetSizer()->AddSpacer(5);
   Layout();
   Fit();
   SetMinSize(GetSize());
   Center();

   EnableControls();
}
Exemplo n.º 21
0
void SelectionBar::Populate()
{
   mLeftTime = mRightTime = mAudioTime = nullptr;

   // This will be inherited by all children:
   SetFont(wxFont(
#ifdef __WXMAC__
                  12
#else
                  9
#endif
                  ,
                  wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL));

   wxFlexGridSizer *mainSizer;

   /* we don't actually need a control yet, but we want to use it's methods
    * to do some look-ups, so we'll have to create one. We can't make the
    * look-ups static because they depend on translations which are done at
    * runtime */
   wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString);

   Add((mainSizer = safenew wxFlexGridSizer(7, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);

   //
   // Top row (mostly labels)
   //

   mainSizer->Add(safenew wxStaticText(this, -1, _("Project Rate (Hz):"),
   // LLL:  On my Ubuntu 7.04 install, the label wraps to two lines
   //       and I could not figure out why.  Thus...hackage.
#if defined(__WXGTK__)
                  wxDefaultPosition, wxSize(110, -1)),
#else
                  wxDefaultPosition, wxDefaultSize),
#endif
               0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);

   mainSizer->Add(5, 1);

   mainSizer->Add(safenew wxStaticText(this, -1, _("Snap To:")),
               0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);

   mainSizer->Add(safenew wxStaticText(this, -1, _("Selection Start:")),
               0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);

   bool showSelectionLength = false;
   gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength);

   {
      auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
      mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, _("End"),
         wxDefaultPosition, wxDefaultSize,
         wxRB_GROUP);
      mRightEndButton->SetName(_("End"));
      mRightEndButton->SetValue(!showSelectionLength);
      hSizer->Add(mRightEndButton,
         0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
      mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, _("Length"));
      mRightLengthButton->SetName(_("Length"));
      mRightLengthButton->SetValue(showSelectionLength);
      hSizer->Add(mRightLengthButton,
         0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
#if defined(__WXMSW__)
      // Refer to Microsoft KB article 261192 for an explanation as
      // to why this is needed.  We've only experienced it under Win2k
      // so it's probably been fixed.  But, it doesn't hurt to have this
      // in for all versions.
      wxRadioButton* dummyButton =
         safenew wxRadioButton(this, wxID_ANY, _("hidden"),
         wxDefaultPosition, wxDefaultSize,
         wxRB_GROUP);
      dummyButton->Disable();
      dummyButton->Hide();
#endif
      mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
   }

   mainSizer->Add(5, 1);

   mainSizer->Add(safenew wxStaticText(this, -1, _("Audio Position:")),
                  0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);

   //
   // Middle row (mostly time controls)
   //

   mRateBox = safenew wxComboBox(this, OnRateID,
                             wxT(""),
                             wxDefaultPosition, wxSize(80, -1));
   mRateBox->SetName(_("Project Rate (Hz):"));
   wxTextValidator vld(wxFILTER_INCLUDE_CHAR_LIST);
   vld.SetIncludes(wxArrayString(10, numbers));
   mRateBox->SetValidator(vld);
   mRateBox->SetValue(wxString::Format(wxT("%d"), (int)mRate));
   UpdateRates(); // Must be done _after_ setting value on mRateBox!

   // We need to capture the SetFocus and KillFocus events to set up
   // for keyboard capture.  On Windows and GTK it's easy since the
   // combobox is presented as one control to hook into.
   mRateText = mRateBox;

#if defined(__WXMAC__)
   // The Mac uses a standard wxTextCtrl for the edit portion and that's
   // the control that gets the focus events.  So we have to find the
   // textctrl.
   wxWindowList kids = mRateBox->GetChildren();
   for (unsigned int i = 0; i < kids.GetCount(); i++) {
      wxClassInfo *ci = kids[i]->GetClassInfo();
      if (ci->IsKindOf(CLASSINFO(wxTextCtrl))) {
         mRateText = kids[i];
         break;
      }
   }
#endif

   mRateText->Connect(wxEVT_SET_FOCUS,
                      wxFocusEventHandler(SelectionBar::OnFocus),
                      NULL,
                      this);
   mRateText->Connect(wxEVT_KILL_FOCUS,
                      wxFocusEventHandler(SelectionBar::OnFocus),
                      NULL,
                      this);

   mainSizer->Add(mRateBox, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);

   mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
                                   wxSize(1, toolbarSingle),
                                   wxLI_VERTICAL),
                  0,  wxRIGHT, 5);

   mSnapTo = safenew wxChoice(this, OnSnapToID,
                          wxDefaultPosition, wxDefaultSize,
                          SnapManager::GetSnapLabels());
   mainSizer->Add(mSnapTo,
                  0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
   mSnapTo->SetName(_("Snap To"));
   mSnapTo->SetSelection(mListener ? mListener->AS_GetSnapTo() : SNAP_OFF);

   mSnapTo->Connect(wxEVT_SET_FOCUS,
                    wxFocusEventHandler(SelectionBar::OnFocus),
                    NULL,
                    this);
   mSnapTo->Connect(wxEVT_KILL_FOCUS,
                    wxFocusEventHandler(SelectionBar::OnFocus),
                    NULL,
                    this);

   mLeftTime = safenew NumericTextCtrl(
      NumericConverter::TIME, this, OnLeftTimeID, formatName, 0.0, mRate);
   mLeftTime->SetName(_("Selection Start:"));
   mLeftTime->EnableMenu();
   mainSizer->Add(mLeftTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);

   mRightTime = safenew NumericTextCtrl(
      NumericConverter::TIME, this, OnRightTimeID, formatName, 0.0, mRate);
   mRightTime->SetName(wxString(_("Selection ")) + (showSelectionLength ?
                                                   _("Length") :
                                                   _("End")));
   mRightTime->EnableMenu();
   mainSizer->Add(mRightTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);

   mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
                                   wxSize(1, toolbarSingle),
                                   wxLI_VERTICAL),
                  0, wxRIGHT, 5);

   mAudioTime = safenew NumericTextCtrl(
      NumericConverter::TIME, this, wxID_ANY, formatName, 0.0, mRate);
   mAudioTime->SetName(_("Audio Position:"));
   mAudioTime->EnableMenu();
   mainSizer->Add(mAudioTime, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);

   mainSizer->Layout();

   RegenerateTooltips();

   Layout();

   SetMinSize( GetSizer()->GetMinSize() );
}
Exemplo n.º 22
0
//---------------------------- PUBLIC           -----------------------------//
wxBuildUI::wxBuildUI(wxWindow* parent, const BuildDataPtr &build, 
	wxSettlersGLCanvas* canvas)
: wxBaseUI<wxOwnerDrawWindow>(parent, sMinSizeBuild)
, BuildPopup(this)
, mLastIndex(-1)
, mClickable(false)
{
	SetMinSize(sMinSizeBuild);

	//create the build bitmap we'll use later on
	if(build->mGameObject)
	{
		wxASSERT(NULL != canvas);

		mBuildBitmap = BuildBitmapPtr(
			new BuildGLBitmap(canvas, build->mGameObject, build->mDrawObject, 
			build->mImageKey, build->mImageName, build->mIconName));
	}
	else
	{
		mBuildBitmap = BuildBitmapPtr(new wxBuildUIBitmap(build->mImageKey, 
			build->mImageName, build->mIconName));
	}

	mRule = build->mRule;
	mLogic = build->mLogic;
	mLegend = build->mLegend;
	mLogicCost = build->mLogicCost;
	mKeyEvent = shEvent;
	mKeyEvent += build->mKeyEvent;

	// Set the button ID properly.
	mButtonID = ID_BUTTON0 + sButtonOffset++;

	//create the bitmap window
	mBitmap = boost::shared_ptr<wxBuildBitmap>(
			new wxBuildBitmap(this, mButtonID, 
			wxBitmap(1, 1)), 
			no_delete_build());

	mBitmap->SetText(mLegend);
	mBitmap->SetLogicCost(mLogicCost);
	mBitmap->SetKeyEvent(mKeyEvent);

	SetText(mLegend);
	SetLogicCost(mLogicCost);
	SetKeyEvent(mKeyEvent);

	sBackgroundBuild = SKIN.Element(shBackground);
	sOutline = SKIN.Element(shGameUIOutline);
	sClickable = SKIN.Element(shGameUIClickable);

	wxSizeEvent event(sMinSizeBuild);
	Size(event);

	mBitmap->Enable(false);
	mBitmap->Show(false);

	Enable(false);
	Show(true);
	
	Controller::get().AddReceiver(shEventBuildUI, &wxBuildUI::OnUpdate, 
		this);
	Controller::get().AddReceiver(shEventShutdownUI, &wxBuildUI::OnShutdownUI, 
		this);
	Controller::get().AddReceiver(shEventResetBitmaps,
		&wxBuildUI::OnResetBitmaps, this);
	Controller::get().AddReceiver(mKeyEvent, &wxBuildUI::OnKeyEvent, this);
}
Exemplo n.º 23
0
void GribSettingsDialog::SetSettingsDialogSize()
{
#ifdef __OCPN__ANDROID__
    /*Sizing do not work with wxScolledWindow so we need to compute it
    using fixed X/Y margin to try to center nicely the dialog in the screen*/
	int wt,ht,w,h;
        ::wxDisplaySize( &wt, &ht);                                                         // the screen size

	int XMargin = 100, YMargin = 200;													//set margins
	w = wt - XMargin;																	//maximum scolled window size
    h = ht - ( m_sButton->GetSize().GetY() + YMargin );
	wxSize scroll(0, 0);
#else        
    /*Sizing do not work with wxScolledWindow so we need to compute it*/
    
    wxWindow *frame = wxTheApp->GetTopWindow();  

    int w = frame->GetClientSize().x;           // the display size
    int h = frame->GetClientSize().y;
    int dMargin = 80;                          //set a margin
	w -= dMargin;								//width available for the scrolled window
    h -= (2 * m_sButton->GetSize().GetY()) + dMargin; //height available for the scrolled window
                                                      //two times the button's height to handle pages tab's height
#endif
#ifdef __WXGTK__
    SetMinSize( wxSize( 0, 0 ) );
#endif
	for( size_t i = 0; i < m_nSettingsBook->GetPageCount(); i++ ) {						//compute and set scrolled windows size
		wxScrolledWindow *sc = ((wxScrolledWindow*) m_nSettingsBook->GetPage( i ));
		sc->SetMinSize( wxSize( 0, 0 ) );
		wxSize scr;
		if( (int)i == m_SetBookpageIndex ) {
            switch( i ) {
                case 0:
                    scr = m_fgSetDataSizer->Fit( sc ); break;
                case 1:
                    //set a reasonable speed slider's width
                    m_sUpdatesPerSecond->SetMinSize( wxSize( m_cLoopStartPoint->GetSize().x, -1) );
                    scr = m_fgSetPlaybackSizer->Fit( sc );
                    break;
                case 2:
                    scr = m_fgSetGuiSizer->Fit( sc );
            }
            sc->SetMinSize( wxSize(wxMin( scr.x, w ), wxMin( scr.y, h )) );
#if defined __WXMSW__ || defined ( __WXOSX__ )
            sc->Show();
#endif
        }
    } // end compute

#ifdef __OCPN__ANDROID__
	m_nSettingsBook->SetSize( wt, -1);
#endif

	Layout();
    Fit();
#ifdef __WXGTK__
    wxSize sd = GetSize();
    if( sd.y == GetClientSize().y ) sd.y += 30;
    SetSize( wxSize( sd.x, sd.y ) );
    SetMinSize( wxSize( sd.x, sd.y ) );
#endif
	Refresh();
}
Exemplo n.º 24
0
FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
                           const wxString & title,
                           const wxPoint & pos)
:  wxDialogWrapper(parent, id, title, pos, wxDefaultSize,
            wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX),
   mAnalyst(std::make_unique<SpectrumAnalyst>())
{
   SetName(GetTitle());

   mMouseX = 0;
   mMouseY = 0;
   mRate = 0;
   mDataLen = 0;

   p = GetActiveProject();
   if (!p)
      return;

   wxArrayString algChoices;
   algChoices.Add(_("Spectrum"));
   algChoices.Add(_("Standard Autocorrelation"));
   algChoices.Add(_("Cuberoot Autocorrelation"));
   algChoices.Add(_("Enhanced Autocorrelation"));
     /* i18n-hint: This is a technical term, derived from the word
      * "spectrum".  Do not translate it unless you are sure you
      * know the correct technical word in your language. */
   algChoices.Add(_("Cepstrum"));

   wxArrayString sizeChoices;
   sizeChoices.Add(wxT("128"));
   sizeChoices.Add(wxT("256"));
   sizeChoices.Add(wxT("512"));
   sizeChoices.Add(wxT("1024"));
   sizeChoices.Add(wxT("2048"));
   sizeChoices.Add(wxT("4096"));
   sizeChoices.Add(wxT("8192"));
   sizeChoices.Add(wxT("16384"));
   sizeChoices.Add(wxT("32768"));
   sizeChoices.Add(wxT("65536"));

   wxArrayString funcChoices;
   for (int i = 0, cnt = NumWindowFuncs(); i < cnt; i++)
   {
      /* i18n-hint: This refers to a "window function",
       * such as Hann or Rectangular, used in the
       * Frequency analyze dialog box. */
      funcChoices.Add(wxString::Format("%s window",  WindowFuncName(i) ) );
   }

   wxArrayString axisChoices;
   axisChoices.Add(_("Linear frequency"));
   axisChoices.Add(_("Log frequency"));

   mFreqFont = wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
   mArrowCursor = std::make_unique<wxCursor>(wxCURSOR_ARROW);
   mCrossCursor = std::make_unique<wxCursor>(wxCURSOR_CROSS);

   gPrefs->Read(wxT("/FreqWindow/DrawGrid"), &mDrawGrid, true);

   long size;
   gPrefs->Read(wxT("/FreqWindow/SizeChoice"), &mSize, 3);
   sizeChoices[mSize].ToLong(&size);
   mWindowSize = size;

   int alg;
   gPrefs->Read(wxT("/FreqWindow/AlgChoice"), &alg, 0);
   mAlg = static_cast<SpectrumAnalyst::Algorithm>(alg);

   gPrefs->Read(wxT("/FreqWindow/FuncChoice"), &mFunc, 3);
   gPrefs->Read(wxT("/FreqWindow/AxisChoice"), &mAxis, 1);
   gPrefs->Read(ENV_DB_KEY, &dBRange, ENV_DB_RANGE);
   if(dBRange < 90.)
      dBRange = 90.;

   ShuttleGui S(this, eIsCreating);

   S.SetBorder(0);

   S.AddSpace(5);

   S.SetSizerProportion(1);
   S.StartMultiColumn(3, wxEXPAND);
   {
      S.SetStretchyCol(1);
      S.SetStretchyRow(0);

      // -------------------------------------------------------------------
      // ROW 1: Freq response panel and sliders for vertical scale
      // -------------------------------------------------------------------

      S.StartVerticalLay(2);
      {
         vRuler = safenew RulerPanel(this, wxID_ANY);
         vRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes
         vRuler->ruler.SetOrientation(wxVERTICAL);
         vRuler->ruler.SetRange(0.0, -dBRange);
         vRuler->ruler.SetFormat(Ruler::LinearDBFormat);
         vRuler->ruler.SetUnits(_("dB"));
         vRuler->ruler.SetLabelEdges(true);
         int w;
         vRuler->ruler.GetMaxSize(&w, NULL);
         vRuler->SetMinSize(wxSize(w, 150));  // height needed for wxGTK
         vRuler->SetTickColour( theTheme.Colour( clrGraphLabels ));

         S.AddSpace(wxDefaultCoord, 1);
         S.Prop(1);
         S.AddWindow(vRuler, wxALIGN_RIGHT | wxALIGN_TOP);
         S.AddSpace(wxDefaultCoord, 1);
      }
      S.EndVerticalLay();

      mFreqPlot = safenew FreqPlot(this);
      mFreqPlot->SetMinSize(wxSize(wxDefaultCoord, FREQ_WINDOW_HEIGHT));
      S.Prop(1);
      S.AddWindow(mFreqPlot, wxEXPAND);

      S.StartHorizontalLay(wxEXPAND, 0);
      {
         S.StartVerticalLay();
         {
            mPanScroller = safenew wxScrollBar(this, FreqPanScrollerID,
               wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
            mPanScroller->SetName(_("Scroll"));
            S.Prop(1);
            S.AddWindow(mPanScroller, wxALIGN_LEFT | wxTOP);
         }
         S.EndVerticalLay();

         S.StartVerticalLay();
         {
            wxStaticBitmap *zi = safenew wxStaticBitmap(this, wxID_ANY, wxBitmap(ZoomIn));
            S.AddWindow((wxWindow *) zi, wxALIGN_CENTER);

            S.AddSpace(5);

            mZoomSlider = safenew wxSlider(this, FreqZoomSliderID, 100, 1, 100,
               wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL);
            S.Prop(1);
            S.AddWindow(mZoomSlider, wxALIGN_CENTER_HORIZONTAL);
            mZoomSlider->SetName(_("Zoom"));

            S.AddSpace(5);

            wxStaticBitmap *zo = safenew wxStaticBitmap(this, wxID_ANY, wxBitmap(ZoomOut));
            S.AddWindow((wxWindow *) zo, wxALIGN_CENTER);
         }
         S.EndVerticalLay();

         S.AddSpace(5, wxDefaultCoord);
      }
      S.EndHorizontalLay();

      // -------------------------------------------------------------------
      // ROW 2: Frequency ruler
      // -------------------------------------------------------------------

      S.AddSpace(1);

      S.StartHorizontalLay(wxEXPAND, 0);
      {
         hRuler  = safenew RulerPanel(this, wxID_ANY);
         hRuler->ruler.SetBounds(0, 0, 100, 100); // Ruler can't handle small sizes
         hRuler->ruler.SetOrientation(wxHORIZONTAL);
         hRuler->ruler.SetLog(true);
         hRuler->ruler.SetRange(10, 20000);
         hRuler->ruler.SetFormat(Ruler::RealFormat);
         hRuler->ruler.SetUnits(_("Hz"));
         hRuler->ruler.SetFlip(true);
         hRuler->ruler.SetLabelEdges(true);
         int h;
         hRuler->ruler.GetMaxSize(NULL, &h);
         hRuler->SetMinSize(wxSize(wxDefaultCoord, h));
         hRuler->SetTickColour( theTheme.Colour( clrGraphLabels ));

         S.AddSpace(1, wxDefaultCoord);
         S.Prop(1);
         S.AddWindow(hRuler, wxALIGN_LEFT | wxALIGN_TOP);
         S.AddSpace(1, wxDefaultCoord);
      }
      S.EndHorizontalLay();

      S.AddSpace(1);

      // -------------------------------------------------------------------
      // ROW 3: Spacer
      // -------------------------------------------------------------------
      S.AddSpace(5);
      S.AddSpace(5);
      S.AddSpace(5);

      // -------------------------------------------------------------------
      // ROW 4: Info
      // -------------------------------------------------------------------

      S.AddSpace(1);

      S.StartHorizontalLay(wxEXPAND);
      {
         S.SetSizerProportion(1);
         S.StartMultiColumn(6);
         S.SetStretchyCol(1);
         S.SetStretchyCol(3);
         {
            S.AddPrompt(_("Cursor:"));

            S.SetStyle(wxTE_READONLY);
            mCursorText = S.AddTextBox( {}, wxT(""), 10);

            S.AddPrompt(_("Peak:"));

            S.SetStyle(wxTE_READONLY);
            mPeakText = S.AddTextBox( {}, wxT(""), 10);
            S.AddSpace(5);

            mGridOnOff = S.Id(GridOnOffID).AddCheckBox(_("&Grids"), wxT("false"));
            mGridOnOff->SetValue(mDrawGrid);
         }
         S.EndMultiColumn();
      }
      S.EndHorizontalLay();

      S.AddSpace(1);
   }
   S.EndMultiColumn();

   // -------------------------------------------------------------------
   // ROW 5: Spacer
   // -------------------------------------------------------------------
   
   S.AddSpace(5);

   S.SetBorder(2);
   S.SetSizerProportion(0);
   S.StartMultiColumn(9, wxALIGN_CENTER);
   {
      // ----------------------------------------------------------------
      // ROW 6: Algorithm, Size, Export, Replot
      // ----------------------------------------------------------------

      S.AddSpace(5);

      mAlgChoice = S.Id(FreqAlgChoiceID).AddChoice(_("&Algorithm:"), wxT(""), &algChoices);
      mAlgChoice->SetSelection(mAlg);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);

      S.AddSpace(5);

      mSizeChoice = S.Id(FreqSizeChoiceID).AddChoice(_("&Size:"), wxT(""), &sizeChoices);
      mSizeChoice->SetSelection(mSize);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);

      S.AddSpace(5);

      mExportButton = S.Id(FreqExportButtonID).AddButton(_("&Export..."));

      S.AddSpace(5);


      // ----------------------------------------------------------------
      // ROW 7: Function, Axix, Grids, Close
      // ----------------------------------------------------------------

      S.AddSpace(5);

      mFuncChoice = S.Id(FreqFuncChoiceID).AddChoice(_("&Function:"), wxT(""), &funcChoices);
      mFuncChoice->SetSelection(mFunc);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
      mFuncChoice->MoveAfterInTabOrder(mSizeChoice);

      S.AddSpace(5);

      mAxisChoice = S.Id(FreqAxisChoiceID).AddChoice(_("&Axis:"), wxT(""), &axisChoices);
      mAxisChoice->SetSelection(mAxis);
      S.SetSizeHints(wxDefaultCoord, wxDefaultCoord);
      mAxisChoice->MoveAfterInTabOrder(mFuncChoice);

      S.AddSpace(5);

      mReplotButton = S.Id(ReplotButtonID).AddButton(_("&Replot..."));

      S.AddSpace(5);

      //mCloseButton = S.Id(wxID_CANCEL).AddButton(_("&Close"));

      //S.AddSpace(5);
   }
   S.EndMultiColumn();
   S.AddStandardButtons( eHelpButton | eCloseButton );

   // -------------------------------------------------------------------
   // ROW 8: Spacer
   // -------------------------------------------------------------------

   S.AddSpace(5);

   mProgress = safenew FreqGauge(this); //, wxID_ANY, wxST_SIZEGRIP);
   S.AddWindow(mProgress, wxEXPAND);

   // Log-frequency axis works for spectrum plots only.
   if (mAlg != SpectrumAnalyst::Spectrum)
   {
      mAxis = 0;
      mAxisChoice->Disable();
   }
   mLogAxis = mAxis != 0;

   mCloseButton = reinterpret_cast<wxButton*>(FindWindowById( wxID_CANCEL ));
   mCloseButton->SetDefault();
   mCloseButton->SetFocus();

   Layout();
   Fit();
   // Bug 1607:
   Center();

   SetMinSize(GetSize());
   mAlgChoice->SetFocus();

#if defined(__WXGTK__)
   // This should be rechecked with wx3.
   //
   // The scrollbar (focus some reason) doesn't allow tabbing past it
   // because it can't receive focus.  So, convince it otherwise.
   //
   // Unfortunately, this still doesn't let you adjust the scrollbar
   // from the keyboard.  Near as I can tell, wxWGTK is capturing the
   // keyboard input, so the GTK widget doesn't see it, preventing
   // the normal scroll events from being generated.
   //
   // I guess the only way round it would be to handle key actions
   // ourselves, but we'll leave that for a future date.
//   gtk_widget_set_can_focus(mPanScroller->m_widget, true);
#endif
}
Exemplo n.º 25
0
FFTviewerFrame::FFTviewerFrame(wxWindow* parent,wxWindowID id)
{
    m_ControlPanel = NULL;
    LMAL_Initialize();
    m_ControlPanel = new frControlPanel(this, ID_CONTROL_PANEL);
    //(*Initialize(FFTviewerFrame)
    wxMenuItem* MenuItem2;
    wxMenuItem* MenuItem1;
    wxFlexGridSizer* FlexGridSizer1;
    wxMenu* Menu1;
    wxMenuBar* MenuBar1;
    wxMenu* Menu2;

    Create(parent, wxID_ANY, _("FFT viewer"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
    SetClientSize(wxSize(900,700));
    SetMinSize(wxSize(900,700));
    FlexGridSizer1 = new wxFlexGridSizer(1, 1, 0, 0);
    FlexGridSizer1->AddGrowableCol(0);
    FlexGridSizer1->AddGrowableRow(0);
    Notebook1 = new wxNotebook(this, ID_NOTEBOOK1, wxDefaultPosition, wxSize(800,600), 0, _T("ID_NOTEBOOK1"));
    Notebook1->SetMinSize(wxSize(900,500));
    mSpectrum = new pnlSpectrum(Notebook1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
    Notebook1->AddPage(mSpectrum, _("Spectrum"), false);
    FlexGridSizer1->Add(Notebook1, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
    SetSizer(FlexGridSizer1);
    MenuBar1 = new wxMenuBar();
    Menu1 = new wxMenu();
    MenuItem1 = new wxMenuItem(Menu1, ID_MENUITEM1, _("Close\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
    Menu1->Append(MenuItem1);
    MenuItem3 = new wxMenuItem(Menu1, ID_MENUITEM2, _("Start capturing samples"), wxEmptyString, wxITEM_NORMAL);
    Menu1->Append(MenuItem3);
    MenuItem4 = new wxMenuItem(Menu1, ID_MENUITEM3, _("Stop capturing samples"), wxEmptyString, wxITEM_NORMAL);
    Menu1->Append(MenuItem4);
    MenuItem5 = new wxMenuItem(Menu1, ID_MENUITEM4, _("Read settings"), wxEmptyString, wxITEM_NORMAL);
    Menu1->Append(MenuItem5);
    MenuItem6 = new wxMenuItem(Menu1, ID_MENUITEM5, _("Send settings"), wxEmptyString, wxITEM_NORMAL);
    Menu1->Append(MenuItem6);
    MenuBar1->Append(Menu1, _("&File"));
    Menu3 = new wxMenu();
    MenuItem7 = new wxMenuItem(Menu3, ID_MENUITEM6, _("Control Panel"), wxEmptyString, wxITEM_NORMAL);
    Menu3->Append(MenuItem7);
    MenuBar1->Append(Menu3, _("Tools"));
    Menu2 = new wxMenu();
    MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
    Menu2->Append(MenuItem2);
    MenuBar1->Append(Menu2, _("Help"));
    SetMenuBar(MenuBar1);
    mStatusBar = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
    int __wxStatusBarWidths_1[3] = { 10, -128, -550 };
    int __wxStatusBarStyles_1[3] = { wxSB_NORMAL, wxSB_NORMAL, wxSB_NORMAL };
    mStatusBar->SetFieldsCount(3,__wxStatusBarWidths_1);
    mStatusBar->SetStatusStyles(3,__wxStatusBarStyles_1);
    SetStatusBar(mStatusBar);
    SetSizer(FlexGridSizer1);
    Layout();

    Connect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnQuit);
    Connect(ID_MENUITEM2,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnMenuStartCaptureSelected);
    Connect(ID_MENUITEM3,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnMenuStopCaptureSelected);
    Connect(ID_MENUITEM4,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnMenuReadSettingsSelected);
    Connect(ID_MENUITEM5,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnMenuSendSettingsSelected);
    Connect(ID_MENUITEM6,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnMenuItem7Selected);
    Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&FFTviewerFrame::OnAbout);
    //*)

    frmFFTMainWindow = this;
    //initialize library and set callback functions

	LMAL_MainSetCallbackInterfaceUpdate(UpdateInterface);
	LMLL_Testing_SetCallbackUpdateInterface(UpdateInterface);

	this->SetTitle(this->GetTitle() + " v" + AutoVersion::FULLVERSION_STRING);
	UpdateInterface(UPDATE_VER_REV_MASK, NULL);

    #ifdef WIN32
	SetIcon(wxICON(aaaa));
	#endif
}
Exemplo n.º 26
0
void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
{
   S.SetBorder(2);

   S.TieCheckBox(_("Attempt to use filter in OpenFile dialog first"),
         wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"),
         true);
   S.StartStatic(_("Rules to choose import filters"), 1);
   {
      S.SetSizerProportion(1);
      S.StartHorizontalLay (wxEXPAND, 1);
      {
         bool fillRuleTable = false;
         if (RuleTable == NULL)
         {
            RuleTable = new Grid(S.GetParent(),EIPRuleTable);
           
            RuleTable->SetColLabelSize(RuleTable->GetDefaultRowSize());
#if EXTIMPORT_MIME_SUPPORT
            RuleTable->CreateGrid (0, 2, wxGrid::wxGridSelectRows);
#else
            RuleTable->CreateGrid (0, 1, wxGrid::wxGridSelectRows);
#endif
            RuleTable->DisableDragColMove ();
            RuleTable->DisableDragRowSize ();
            RuleTable->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
            RuleTable->SetColLabelValue (0, _("File extensions"));
#if EXTIMPORT_MIME_SUPPORT
            RuleTable->SetColLabelValue (1, _("Mime-types"));
#endif
            RuleTable->SetRowLabelSize (0);
            RuleTable->SetSelectionMode (wxGrid::wxGridSelectRows);
            RuleTable->AutoSizeColumns ();

            RuleTable->SetDropTarget (dragtarget1);
            RuleTable->EnableDragCell (true);
            fillRuleTable = true;
         }
         S.AddWindow(RuleTable, wxEXPAND | wxALL);
       
         PluginList = S.Id(EIPPluginList).AddListControl ();
           
         if (fillRuleTable)
         {
            PluginList->SetSingleStyle (wxLC_REPORT, true);
            PluginList->SetSingleStyle (wxLC_SINGLE_SEL, true);
            PluginList->InsertColumn (0, _("Importer order"));
            PluginList->SetDropTarget (dragtarget2);

            ExtImportItems *items = wxGetApp().mImporter->GetImportItems();         
            for (unsigned int i = 0; i < items->Count(); i++)
               AddItemToTable (i, &(*items)[i]);
            if (items->Count() > 0)
            {
               RuleTable->SelectRow(0);
               RuleTable->SetGridCursor(0,0);
            }
         }         
      }
      S.EndHorizontalLay();
      S.StartHorizontalLay (wxSHRINK, 0);
      {
          MoveRuleUp = S.Id (EIPMoveRuleUp).AddButton (_("Move rule &up"));
          MoveRuleDown = S.Id (EIPMoveRuleDown).AddButton
                (_("Move rule &down"));
          MoveFilterUp = S.Id (EIPMoveFilterUp).AddButton
                (_("Move f&ilter up"));
          MoveFilterDown = S.Id (EIPMoveFilterDown).AddButton
                (_("Move &filter down"));
      }
      S.EndHorizontalLay();
      S.StartHorizontalLay (wxSHRINK, 0);
      {
          AddRule = S.Id (EIPAddRule).AddButton (_("&Add new rule"));
          DelRule = S.Id (EIPDelRule).AddButton (_("De&lete selected rule"));
      }
      S.EndHorizontalLay();
   }
   S.EndStatic();
   Layout();
   Fit();
   SetMinSize(GetSize());
}
Exemplo n.º 27
0
//
// Layout the toolbars
//
void ToolDock::LayoutToolBars()
{
   wxRect stack[ ToolBarCount + 1 ];
   wxPoint cpos, lpos;
   ToolBar *lt = NULL;
   int ndx, stkcnt = 0;
   int width, height;

   // Get size of our parent since we haven't been sized yet
   GetParent()->GetClientSize( &width, &height );
   width -= toolbarGap;
   height -= toolbarGap;

   // Get the number of docked toolbars and take a quick exit
   // if we don't have any
   int cnt = mDockedBars.GetCount();
   if( cnt == 0 )
   {
      SetMinSize( wxSize( width, toolbarGap ) );
      return;
   }

   // Set initial stack entry to maximum size
   stack[ 0 ].SetX( toolbarGap );
   stack[ 0 ].SetY( toolbarGap );
   stack[ 0 ].SetWidth( width );
   stack[ 0 ].SetHeight( height );

   // Process all docked and visible toolbars
   for( ndx = 0; ndx < cnt; ndx++ )
   {
      // Cache toolbar pointer
      ToolBar *ct = (ToolBar *)mDockedBars[ ndx ];

      // Get and cache the toolbar sizes
      wxSize sz = ct->GetSize();
      int tw = sz.GetWidth() + toolbarGap;
      int th = sz.GetHeight() + toolbarGap;

      // Will this one fit in remaining horizontal space?
      if( ( tw > stack[ stkcnt ].GetWidth() ) ||
          ( th > stack[ stkcnt ].GetHeight() ) )
      {
         // Destack entries until one is found in which this bar
         // will fit or until we run out of stacked entries
         while( stkcnt > 0 )
         {
            stkcnt--;

            // Get out if it will fit
            if( ( tw <= stack[ stkcnt ].GetWidth() ) &&
                ( th <= stack[ stkcnt ].GetHeight() ) )
            {
               break;
            }
         }
      }

      // The current stack entry position is where the bar
      // will be placed.
      cpos = stack[ stkcnt ].GetPosition();

      // We'll be using at least a portion of this stack entry, so
      // adjust the location and size.  It is possible that these
      // will become zero if this entry and the toolbar have the
      // same height.  This is what we want as it will be destacked
      // in the next iteration.
      stack[ stkcnt ].SetY(      stack[ stkcnt ].GetY()      + th );
      stack[ stkcnt ].SetHeight( stack[ stkcnt ].GetHeight() - th );

      // Calc the next possible horizontal location.
      int x = cpos.x + tw;

      // Add a new stack entry
      stkcnt++;
      stack[ stkcnt ].SetX( x );
      stack[ stkcnt ].SetY( cpos.y );
      stack[ stkcnt ].SetWidth( width - x );
      stack[ stkcnt ].SetHeight( th );

      // Position the previous toolbar
      if( ndx > 0 )
      {
         // Keep the tab order in order
         ct->MoveAfterInTabOrder( lt );

         // Place the last toolbar
         lt->SetPosition( wxPoint( lpos.x, lpos.y ) );
      }

      // Place the final toolbar
      if( ndx == cnt - 1 )
      {
         ct->SetPosition( wxPoint( cpos.x, cpos.y ) );
      }

      // Remember for next iteration
      lt = ct;
      lpos = cpos;
   }

   // Set the final size of the dock window
   SetMinSize( wxSize( -1, stack[ 0 ].GetY() ) );

   // Clean things up
   Refresh( false );
}
Exemplo n.º 28
0
bool wxPickerBase::CreateBase(wxWindow *parent,
                         wxWindowID id,
                         const wxString &text,
                         const wxPoint& pos,
                         const wxSize& size,
                         long style,
                         const wxValidator& validator,
                         const wxString& name)
{
    // remove any border style from our style as wxPickerBase's window must be
    // invisible (user styles must be set on the textctrl or the platform-dependent picker)
    style &= ~wxBORDER_MASK;

    if (!wxControl::Create(parent, id, pos, size, style | wxNO_BORDER | wxTAB_TRAVERSAL,
                           validator, name))
        return false;

    SetMinSize( size );

    m_sizer = new wxBoxSizer(wxHORIZONTAL);

    if (HasFlag(wxPB_USE_TEXTCTRL))
    {
        // NOTE: the style of this class (wxPickerBase) and the style of the
        //       attached text control are different: GetTextCtrlStyle() extracts
        //       the styles related to the textctrl from the styles passed here
        m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
                                wxDefaultPosition, wxDefaultSize,
                                GetTextCtrlStyle(style));
        if (!m_text)
        {
            wxFAIL_MSG( wxT("wxPickerBase's textctrl creation failed") );
            return false;
        }

        // set the maximum lenght allowed for this textctrl.
        // This is very important since any change to it will trigger an update in
        // the m_picker; for very long strings, this real-time synchronization could
        // become a CPU-blocker and thus should be avoided.
        // 32 characters will be more than enough for all common uses.
        m_text->SetMaxLength(32);

        // set the initial contents of the textctrl
        m_text->SetValue(text);

        m_text->Connect(m_text->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
                wxCommandEventHandler(wxPickerBase::OnTextCtrlUpdate),
                NULL, this);
        m_text->Connect(m_text->GetId(), wxEVT_KILL_FOCUS,
                wxFocusEventHandler(wxPickerBase::OnTextCtrlKillFocus),
                NULL, this);

        m_text->Connect(m_text->GetId(), wxEVT_DESTROY,
                wxWindowDestroyEventHandler(wxPickerBase::OnTextCtrlDelete),
                NULL, this);

        // the text control's proportion values defaults to 2
        m_sizer->Add(m_text, 2, GetDefaultTextCtrlFlag(), 5);
    }

    return true;
}
Exemplo n.º 29
0
/* BrowserWindow::BrowserWindow
 * BrowserWindow class constructor
 *******************************************************************/
BrowserWindow::BrowserWindow(wxWindow* parent)
	: wxDialog(parent, -1, "Browser", wxDefaultPosition, wxDefaultSize,
		wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX)
{
	// Init size/pos
	Misc::winf_t info = Misc::getWindowInfo("browser");
	if (!info.id.IsEmpty())
	{
		SetSize(info.width, info.height);
		SetPosition(wxPoint(info.left, info.top));
	}
	else
		Misc::setWindowInfo("browser", 768, 600, 0, 0);

	// Init variables
	items_root = new BrowserTreeNode();
	items_root->setName("All");
	truncate_names = false;

	// Setup layout
	wxBoxSizer* m_vbox = new wxBoxSizer(wxVERTICAL);
	SetSizer(m_vbox);

	//wxSplitterWindow* swin = new wxSplitterWindow(this, -1);
	wxBoxSizer* m_hbox = new wxBoxSizer(wxHORIZONTAL);
	m_vbox->Add(m_hbox, 1, wxEXPAND|wxALL, 4);

	// Browser tree
	tree_items = new wxTreeListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxTL_SINGLE|wxDV_ROW_LINES);
	m_hbox->Add(tree_items, 0, wxEXPAND|wxALL, 4);

	// Browser area
	wxBoxSizer* vbox = new wxBoxSizer(wxVERTICAL);
	m_hbox->Add(vbox, 1, wxEXPAND|wxALL, 4);

	// Zoom
	wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL);
	vbox->Add(hbox, 0, wxEXPAND|wxBOTTOM, 4);
	slider_zoom = new wxSlider(this, -1, browser_item_size, 64, 256);
	slider_zoom->SetLineSize(16);
	slider_zoom->SetPageSize(32);
	hbox->Add(new wxStaticText(this, -1, "Zoom:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2);
	hbox->Add(slider_zoom, 1, wxEXPAND);

	// Sorting
	choice_sort = new wxChoice(this, -1);
	hbox->AddStretchSpacer();
	hbox->Add(new wxStaticText(this, -1, "Sort:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2);
	hbox->Add(choice_sort, 0, wxEXPAND|wxRIGHT, 4);

	// Filter
	text_filter = new wxTextCtrl(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
	hbox->Add(new wxStaticText(this, -1, "Filter:"), 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 2);
	hbox->Add(text_filter, 0, wxEXPAND|wxRIGHT, 4);

	// Browser canvas
	hbox = new wxBoxSizer(wxHORIZONTAL);
	vbox->Add(hbox, 1, wxEXPAND|wxBOTTOM, 4);
	canvas = new BrowserCanvas(this);
	hbox->Add(canvas, 1, wxEXPAND);

	// Canvas scrollbar
	wxScrollBar* scrollbar = new wxScrollBar(this, -1, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
	hbox->Add(scrollbar, 0, wxEXPAND);
	canvas->setScrollBar(scrollbar);

	// Bottom sizer
	sizer_bottom = new wxBoxSizer(wxHORIZONTAL);
	vbox->Add(sizer_bottom, 0, wxEXPAND|wxBOTTOM, 4);

	// Buttons and info label
	label_info = new wxStaticText(this, -1, "Info goes here");
	wxSizer* buttonsizer = CreateButtonSizer(wxOK|wxCANCEL);
	buttonsizer->Insert(0, label_info, 1, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 4);

	m_vbox->Add(buttonsizer, 0, wxEXPAND|wxBOTTOM, 4);

	// Setup sorting options
	addSortType("Index");
	addSortType("Name (Alphabetical)");
	choice_sort->SetSelection(0);

	// Bind events
	tree_items->Bind(wxEVT_TREELIST_SELECTION_CHANGED, &BrowserWindow::onTreeItemSelected, this);
	choice_sort->Bind(wxEVT_CHOICE, &BrowserWindow::onChoiceSortChanged, this);
	canvas->Bind(wxEVT_LEFT_DCLICK, &BrowserWindow::onCanvasDClick, this);
	text_filter->Bind(wxEVT_TEXT, &BrowserWindow::onTextFilterChanged, this);
	slider_zoom->Bind(wxEVT_SLIDER, &BrowserWindow::onZoomChanged, this);
	Bind(wxEVT_BROWSERCANVAS_SELECTION_CHANGED, &BrowserWindow::onCanvasSelectionChanged, this, canvas->GetId());
	canvas->Bind(wxEVT_CHAR, &BrowserWindow::onCanvasKeyChar, this);

	Layout();
	SetMinSize(wxSize(540, 400));

	if (browser_maximised)
		Maximize();
	else
		CenterOnParent();

	// Set focus to canvas
	canvas->SetFocus();
}
Exemplo n.º 30
0
GRIBUIDialog::GRIBUIDialog(wxWindow *parent, grib_pi *ppi)
: GRIBUIDialogBase(parent)
{
    pParent = parent;
    pPlugIn = ppi;

    m_bGRIBActiveFile = NULL;
    m_pTimelineSet = NULL;

    wxFileConfig *pConf = GetOCPNConfigObject();

    if(pConf) {
        pConf->SetPath ( _T ( "/Settings/GRIB" ) );

        bool value;
        pConf->Read( _T ( "WindPlot" ), &value, true );
        m_cbWind->SetValue(value);
        pConf->Read( _T ( "WindGustPlot" ), &value, true );
        m_cbWindGust->SetValue(value);
        pConf->Read( _T ( "PressurePlot" ), &value, true );
        m_cbPressure->SetValue(value);
        pConf->Read( _T ( "WavePlot" ), &value, false );
        m_cbWave->SetValue(value);
        pConf->Read( _T ( "CurrentPlot" ), &value, false );
        m_cbCurrent->SetValue(value);
        pConf->Read( _T ( "PrecipitationPlot" ), &value, false );
        m_cbPrecipitation->SetValue(value);
        pConf->Read( _T ( "CloudPlot" ), &value, false );
        m_cbCloud->SetValue(value);
        pConf->Read( _T ( "AirTemperaturePlot" ), &value, false );
        m_cbAirTemperature->SetValue(value);
        pConf->Read( _T ( "SeaTemperaturePlot" ), &value, false );
        m_cbSeaTemperature->SetValue(value);

        pConf->Read ( _T ( "lastdatatype" ), &m_lastdatatype, 0);

        pConf->Read ( _T ( "Filename" ), &m_file_name );

        wxStandardPaths spath;
        pConf->SetPath ( _T ( "/Directories" ) );
        pConf->Read ( _T ( "GRIBDirectory" ), &m_grib_dir, spath.GetDocumentsDir()  );
    }

#if !wxCHECK_VERSION(2,9,4) /* to work with wx 2.8 */
#define SetBitmap SetLabel
#endif

    m_bpPrev->SetBitmap(wxBitmap( prev ));
    m_bpNext->SetBitmap(wxBitmap( next ));
    m_bpNow->SetBitmap(wxBitmap( now ));
    m_bpOpenFile->SetBitmap(wxBitmap( openfile ));
    m_bpSettings->SetBitmap(wxBitmap( setting ));
    m_bpRequest->SetBitmap(wxBitmap( request ));

    m_tPlayStop.Connect(wxEVT_TIMER, wxTimerEventHandler( GRIBUIDialog::OnPlayStopTimer ), NULL, this);

    m_OverlaySettings.Read();

    DimeWindow( this );

    m_pTimelineSet = NULL;
    PopulateTrackingControls();

    Fit();
    SetMinSize( GetBestSize() );
}