Beispiel #1
0
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
       : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{
    SetIcon(wxICON(sample));

    // create a menu bar
    wxMenu *menuFile = new wxMenu;

    menuFile->Append(NetTest_Dial, wxT("&Dial\tCtrl-D"), wxT("Dial default ISP"));
    menuFile->Append(NetTest_HangUp, wxT("&HangUp\tCtrl-H"), wxT("Hang up modem"));
    menuFile->AppendSeparator();
    menuFile->Append(NetTest_EnumISP, wxT("&Enumerate ISPs...\tCtrl-E"));
    menuFile->Append(NetTest_Check, wxT("&Check connection status...\tCtrl-C"));
    menuFile->AppendSeparator();
    menuFile->Append(NetTest_About, wxT("&About\tCtrl-A"), wxT("Show about dialog"));
    menuFile->AppendSeparator();
    menuFile->Append(NetTest_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));

    // now append the freshly created menu to the menu bar...
    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append(menuFile, wxT("&File"));

    // ... and attach this menu bar to the frame
    SetMenuBar(menuBar);

#if wxUSE_STATUSBAR
    // create status bar and fill the LAN field
    CreateStatusBar(3);
    static const int widths[3] = { -1, 100, 60 };
    SetStatusWidths(3, widths);
#endif // wxUSE_STATUSBAR
}
Beispiel #2
0
// -----------  PHDStatusBar Class
//
PHDStatusBar::PHDStatusBar(wxWindow *parent, long style)
    : wxStatusBar(parent, wxID_ANY, wxSTB_SHOW_TIPS | wxSTB_ELLIPSIZE_END | wxFULL_REPAINT_ON_RESIZE, "PHDStatusBar")
{
    std::vector<int> fieldWidths;

    // Set up the only field the wxStatusBar base class will know about
    int widths[] = {-1};

    SetFieldsCount(1);
    SetStatusWidths(1, widths);
    this->SetBackgroundColour(*wxBLACK);

    m_ctrlPanel = new SBPanel(this, wxSize(500, SB_HEIGHT));
    m_ctrlPanel->SetPosition(wxPoint(1, 2));

    // Build the leftmost text status field, the only field managed at this level
    m_Msg1 = new wxStaticText(m_ctrlPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150, -1));
    int txtWidth, txtHeight;
    GetTextExtent(_("Selected star at (999.9, 999.9)"), &txtWidth, &txtHeight);         // only care about the width
    m_Msg1->SetBackgroundColour(*wxBLACK);
    m_Msg1->SetForegroundColour(*wxWHITE);
    fieldWidths.push_back(txtWidth);                    // Doesn't matter but we need to occupy the position in fieldWidths

    // Build the star status fields
    m_StarIndicators = new SBStarIndicators(m_ctrlPanel, fieldWidths);

    // Build the guide indicators
    m_GuideIndicators = new SBGuideIndicators(m_ctrlPanel, fieldWidths);

    // Build the state indicator controls
    m_StateIndicators = new SBStateIndicators(m_ctrlPanel, fieldWidths);

    m_ctrlPanel->BuildFieldOffsets(fieldWidths);
}
void t4p::StatusBarWithGaugeClass::RedrawGauges() {
    // Each gauge takes it 2 columns (one for the gauge title and one for the gauge itself),
    // plus the leftmost default status bar columns (for the menu help and other messages)
    const int DEFAULT_COLUMNS = 2;
    int newColumnCount = (Gauges.size() * 2) + DEFAULT_COLUMNS;
    int* widths = new int[newColumnCount];
    for (int i = 0; i < DEFAULT_COLUMNS; ++i) {
        widths[i] = -1;
    }
    for (int i = DEFAULT_COLUMNS; i < newColumnCount; i += 2) {
        widths[i] = 150;
        widths[i + 1] = 300;
    }
    SetFieldsCount(newColumnCount);
    SetStatusWidths(newColumnCount, widths);

    // ATTN: in MSW this line results in a crash why??
    wxPlatformInfo platform;
    if (!(wxOS_WINDOWS | platform.GetOperatingSystemId())) {
        SetMinHeight(BITMAP_SIZE_Y);
    }
    int col = DEFAULT_COLUMNS;
    for (std::map<int, wxGauge*>::iterator it = Gauges.begin(); it != Gauges.end(); ++it) {
        SetStatusText(GaugeTitles[it->first], col++);
        wxRect rect;
        GetFieldRect(col++, rect);
        it->second->SetSize(rect.x + 2, rect.y + 2, rect.width - 4, rect.height - 4);
    }
    delete[] widths;
}
Beispiel #4
0
void MainWindow::initStatusBar()
{
  CreateStatusBar(2);
  int statusbarwidths[2] = {-1, 120};
  SetStatusWidths(2, statusbarwidths);
  SetStatusText( _("Welcome to "APPLICATION_TITLE"!"), 0);
}
MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
                  const wxPoint &position, const wxSize& size, long style )
        :wxFrame( parent, id, title, position, size, style )
{
    m_preview_state = ID_PREVIEW;

    // set the frame icon
    SetIcon(wxICON(mondrian));

    SetMinSize(wxSize(200, 200));

    // set-up the menu, toolbar, statusbar so we know what the client size will be
    m_menubar = new wxMenuBar();
    SetMenuBar(m_menubar);
    m_toolBar = CreateToolBar();

#if wxUSE_STATUSBAR
    CreateStatusBar(2);
    int status_text_width = 0, status_text_height = 0;
    GetStatusBar()->GetTextExtent(MyVideoCaptureWindow::GetStatusText(999999, 9999),
                                  &status_text_width, &status_text_height);
    int status_widths[2] = {-1, status_text_width};
    SetStatusWidths(2, status_widths);
#endif // wxUSE_STATUSBAR

    m_splitterWin = new wxSplitterWindow(this, wxID_ANY);
    m_splitterWin->SetMinimumPaneSize(20);

    m_logPanel = new wxPanel( m_splitterWin, wxID_ANY );
    wxBoxSizer *logpanelsizer = new wxBoxSizer(wxVERTICAL);
    m_logTextCtrl = new wxTextCtrl(m_logPanel, wxID_ANY,
                                   wxT("Event Log for wxVideoCaptureWindow : \n"),
                                   wxDefaultPosition, wxDefaultSize,
                                   wxTE_MULTILINE|wxTE_RICH2|wxTE_READONLY );
    logpanelsizer->Add(m_logTextCtrl, 1, wxEXPAND);
    m_logPanel->SetAutoLayout( true );
    m_logPanel->SetSizer(logpanelsizer);
    logpanelsizer->Fit( m_logPanel );
    logpanelsizer->SetSizeHints( m_logPanel );

    m_vidCapWin = new MyVideoCaptureWindow( m_splitterWin, ID_VIDEOWIN,
                                            wxDefaultPosition, wxDefaultSize);

#ifdef WXVIDCAP_AVI_SUPPORT
    SetTitle(wxT("wxVidCap - ") + m_vidCapWin->GetCaptureFilename());
#else
    SetTitle(wxT("wxVidCap"));
#endif // WXVIDCAP_AVI_SUPPORT

    m_logPanel->Show(false);
    m_vidCapWin->Show(true);
    m_splitterWin->Initialize(m_vidCapWin);

    CreateMenus();
    CreateToolbar();
    SetupVideoMenus();
}
Beispiel #6
0
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
        const wxString& title, const wxPoint&  pos, const wxSize&   size ) :
    EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
                    KICAD_DEFAULT_DRAWFRAME_STYLE, KICAD_MANAGER_FRAME_NAME ),
    KIWAY_HOLDER( &::Kiway )
{
    m_active_project = false;
    m_leftWinWidth = 60;
    m_manager_Hotkeys_Descr = NULL;

    // Create the status line (bottom of the frame)
    static const int dims[3] = { -1, -1, 100 };

    CreateStatusBar( 3 );
    SetStatusWidths( 3, dims );

    // Give an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_kicad_xpm ) );
    SetIcon( icon );

    // Give the last size and pos to main window
    LoadSettings( config() );
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    // Left window: is the box which display tree project
    m_LeftWin = new TREE_PROJECT_FRAME( this );

    // Right top Window: buttons to launch applications
    m_Launcher = new LAUNCHER_PANEL( this );

    // Add the wxTextCtrl showing all messages from KiCad:
    m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
                                    wxDefaultPosition, wxDefaultSize,
                                    wxTE_MULTILINE | wxTE_READONLY | wxBORDER_NONE );

    RecreateBaseHToolbar();
    ReCreateMenuBar();

    m_auimgr.SetManagedWindow( this );

    m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );

    m_auimgr.AddPane( m_LeftWin, EDA_PANE().Palette().Name( "ProjectTree" ).Left().Layer(3)
                      .CaptionVisible( false ).PaneBorder( false )
                      .MinSize( 150, -1 ).BestSize( m_leftWinWidth, -1 ) );

    m_auimgr.AddPane( m_Launcher, EDA_PANE().HToolbar().Name( "Launcher" ).Top().Layer(1)
                      .MinSize( m_Launcher->GetPanelWidth(), m_Launcher->GetPanelHeight() ) );

    m_auimgr.AddPane( m_MessagesBox, EDA_PANE().Messages().Name( "MsgPanel" ).Center() );

    m_auimgr.Update();

    SetTitle( wxString( "KiCad " ) + GetBuildVersion() );
}
Beispiel #7
0
StatusBar::StatusBar (wxWindow* parent)
  : wxStatusBar (parent)
{
  static const int widths[Field_Max] = {-1, 150, 30};

  SetFieldsCount(Field_Max);
  SetStatusWidths(Field_Max, widths);

  gauge = new wxGauge(this, wxID_ANY, 100);
  gauge->SetValue(0);
}
Beispiel #8
0
HEVCStatusBar::HEVCStatusBar(wxWindow *parent)
            : wxStatusBar(parent, wxID_ANY), m_pZoomSlider(NULL), m_pManager(NULL)
{
    static const int widths[Feild_Max] = { -1, 100, 150 };
    SetFieldsCount(Feild_Max);
    SetStatusWidths(Feild_Max, widths);
    m_pZoomSlider = new wxSlider(this, ZOOMSLIDER_ID, 0, 0, 100);
    wxRect rect;
    GetFieldRect(Feild_ZoomSlider, rect);
    m_pZoomSlider->SetSize(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
}
Beispiel #9
0
WinEDA_CvpcbFrame::WinEDA_CvpcbFrame(WinEDA_App *parent, const wxString & title ):
		WinEDA_BasicFrame(NULL, CVPCB_FRAME, parent, title, wxDefaultPosition, wxDefaultSize )
{
	m_FrameName = "CvpcbFrame";
	m_ListCmp = NULL;
	m_ListMod = NULL;
	DrawFrame = NULL;
	m_FilesMenu = NULL;
	m_HToolBar = NULL;

	// Give an icon
	SetIcon( wxICON(icon_cvpcb));
	SetFont(*g_StdFont);

	SetAutoLayout(TRUE);

	GetSettings();
	if ( m_FrameSize.x < FRAME_MIN_SIZE_X ) m_FrameSize.x = FRAME_MIN_SIZE_X;
	if ( m_FrameSize.y < FRAME_MIN_SIZE_Y ) m_FrameSize.y = FRAME_MIN_SIZE_Y;

	// create the status bar 
int dims[3] = { -1, -1, 150};
	CreateStatusBar(3);
	SetStatusWidths(3,dims);
	ReCreateMenuBar();
    ReCreateHToolbar();

	// Creation des listes de modules disponibles et des composants du schema
	// Create child subwindows.
	BuildCmpListBox();
	BuildModListBox();

	/* Creation des contraintes de dimension de la fenetre d'affichage des composants
		du schema */
	wxLayoutConstraints * linkpos = new wxLayoutConstraints;
	linkpos->top.SameAs(this,wxTop);
	linkpos->bottom.SameAs(this,wxBottom);
	linkpos->left.SameAs(this,wxLeft);
	linkpos->width.PercentOf(this,wxWidth,66);
	m_ListCmp->SetConstraints(linkpos);

	/* Creation des contraintes de dimension de la fenetre d'affichage des modules
		de la librairie */
	linkpos = new wxLayoutConstraints;
	linkpos->top.SameAs(m_ListCmp,wxTop);
	linkpos->bottom.SameAs(m_ListCmp,wxBottom);
	linkpos->right.SameAs(this,wxRight);
	linkpos->left.SameAs(m_ListCmp,wxRight);
	m_ListMod->SetConstraints(linkpos);

	SetSizeHints(FRAME_MIN_SIZE_X,FRAME_MIN_SIZE_Y, -1,-1, -1,-1);	// Set minimal size to w,h
	SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y);
}
Beispiel #10
0
END_EVENT_TABLE() EDA_3D_FRAME::EDA_3D_FRAME( PCB_BASE_FRAME*   parent,
                                              const wxString&   title,
                                              long              style ) :
    EDA_BASE_FRAME( parent, DISPLAY3D_FRAME_TYPE, title,
                    wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
{
    m_canvas        = NULL;
    m_reloadRequest = false;
    m_ortho         = false;

    // Give it an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
    SetIcon( icon );

    GetSettings();
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    // Create the status line
    static const int dims[5] = { -1, 100, 100, 100, 140 };

    CreateStatusBar( 5 );
    SetStatusWidths( 5, dims );

    CreateMenuBar();
    ReCreateMainToolbar();

    // Make a EDA_3D_CANVAS
    int attrs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0 };
    m_canvas = new EDA_3D_CANVAS( this, attrs );

    m_auimgr.SetManagedWindow( this );


    EDA_PANEINFO horiztb;
    horiztb.HorizontalToolbarPane();

    m_auimgr.AddPane( m_mainToolBar,
                      wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() );

    m_auimgr.AddPane( m_canvas,
                      wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );

    m_auimgr.Update();

    // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
    // in order to receive mouse events.  Otherwise, the user has to click somewhere on
    // the canvas before it will respond to mouse wheel events.
    m_canvas->SetFocus();
}
Beispiel #11
0
MyFrame::MyFrame()
    : wxFrame( (wxFrame *)NULL, wxID_ANY, wxT("wxImage sample"),
                wxPoint(20, 20), wxSize(950, 700) )
{
    SetIcon(wxICON(sample));

    wxMenuBar *menu_bar = new wxMenuBar();

    wxMenu *menuImage = new wxMenu;
    menuImage->Append( ID_NEW, wxT("&Show any image...\tCtrl-O"));
    menuImage->Append( ID_INFO, wxT("Show image &information...\tCtrl-I"));
#ifdef wxHAVE_RAW_BITMAP
    menuImage->AppendSeparator();
    menuImage->Append( ID_SHOWRAW, wxT("Test &raw bitmap...\tCtrl-R"));
#endif
#if wxUSE_GRAPHICS_CONTEXT
    menuImage->AppendSeparator();
    menuImage->Append(ID_GRAPHICS, "Test &graphics context...\tCtrl-G");
#endif // wxUSE_GRAPHICS_CONTEXT
    menuImage->AppendSeparator();
    menuImage->Append( ID_SHOWTHUMBNAIL, wxT("Test &thumbnail...\tCtrl-T"),
                        "Test scaling the image during load (try with JPEG)");
    menuImage->AppendSeparator();
    menuImage->Append( ID_ABOUT, wxT("&About\tF1"));
    menuImage->AppendSeparator();
    menuImage->Append( ID_QUIT, wxT("E&xit\tCtrl-Q"));
    menu_bar->Append(menuImage, wxT("&Image"));

#if wxUSE_CLIPBOARD
    wxMenu *menuClipboard = new wxMenu;
    menuClipboard->Append(wxID_COPY, wxT("&Copy test image\tCtrl-C"));
    menuClipboard->Append(wxID_PASTE, wxT("&Paste image\tCtrl-V"));
    menu_bar->Append(menuClipboard, wxT("&Clipboard"));
#endif // wxUSE_CLIPBOARD

    SetMenuBar( menu_bar );

#if wxUSE_STATUSBAR
    CreateStatusBar(2);
    int widths[] = { -1, 100 };
    SetStatusWidths( 2, widths );
#endif // wxUSE_STATUSBAR

    m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) );

    // 500 width * 2750 height
    m_canvas->SetScrollbars( 10, 10, 50, 275 );
    m_canvas->SetCursor(wxImage("cursor.png"));
}
Beispiel #12
0
MyStatusBar::MyStatusBar(wxWindow *parent, long style)
        : wxStatusBar(parent, wxID_ANY, style, "MyStatusBar")
#if wxUSE_TIMER
            , m_timer(this)
#endif
#if wxUSE_CHECKBOX
            , m_checkbox(NULL)
#endif
{
    // compute the size needed for num lock indicator pane
    wxClientDC dc(this);
    wxSize sizeNumLock = dc.GetTextExtent(numlockIndicators[0]);
    sizeNumLock.IncTo(dc.GetTextExtent(numlockIndicators[1]));

    int widths[Field_Max];
    widths[Field_Text] = -1; // growable
    widths[Field_Checkbox] = 150;
    widths[Field_Bitmap] = BITMAP_SIZE_X;
    widths[Field_NumLockIndicator] = sizeNumLock.x;
    widths[Field_Clock] = 100;
    widths[Field_CapsLockIndicator] = dc.GetTextExtent(capslockIndicators[1]).x;

    SetFieldsCount(Field_Max);
    SetStatusWidths(Field_Max, widths);

#if wxUSE_CHECKBOX
    m_checkbox = new wxCheckBox(this, StatusBar_Checkbox, wxT("&Toggle clock"));
    m_checkbox->SetValue(true);
#endif

    m_statbmp = new wxStaticBitmap(this, wxID_ANY, wxIcon(green_xpm));

#if wxUSE_TIMER
    m_timer.Start(1000);
#endif

    SetMinHeight(wxMax(m_statbmp->GetBestSize().GetHeight(),
                       m_checkbox->GetBestSize().GetHeight()));

    UpdateClock();
}
GNC::GUI::StatusBarProgreso::StatusBarProgreso( wxWindow* pPadre, wxWindow* pPadrePanel, bool listenMessages, wxWindowID id, long style) :
        wxStatusBar(pPadre, id, style),
        m_dirty (true)
{
        m_pPanelTareas = new PanelTareasBase(pPadrePanel);
        m_pPanelTareas->Show(false);

        SetFieldsCount(Field_Max); //uno para el texto y el otro para lo q yo quiera
        static const int widths[Field_Max] = { -1, 32, 250, 150};
        SetStatusWidths(Field_Max, widths);

        //mensaje tarea
        m_pMensajeTarea = new wxStaticText(this,wxID_ANY,wxT(""), wxDefaultPosition, wxSize(250, -1), wxST_NO_AUTORESIZE);
        m_pMensajeTarea->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler( StatusBarProgreso::OnMostrarOcultarDialogoProgreso),NULL,this);

        //botoncico de progreso
        m_pIconoProgreso = new wxAnimationCtrl(this,wxID_ANY,GinkgoResourcesManager::ProgressBar::GetAniLoading());
        m_pIconoProgreso->Hide();

        m_pProgresoTarea = new wxGauge(this, wxID_ANY, 100);
        m_pProgresoTarea->Hide();

        m_pIconoParado = new wxStaticBitmap(this,wxID_ANY,GinkgoResourcesManager::ProgressBar::GetIcoStopped());
        m_pIconoParado->Show(true);

        //escuchamos el evento de mensajes
        if (listenMessages) {
                GNC::GCS::Events::EventoMensajes evt(NULL);
                GNC::GCS::ControladorEventos::Instance()->Registrar(this,evt);
        }

        wxSizeEvent event(pPadre->GetSize());
        OnSize(event);

        //onsize
        this->Connect(wxEVT_IDLE, wxIdleEventHandler(StatusBarProgreso::OnIdle), NULL, this);
        this->Connect(wxEVT_SIZE,wxSizeEventHandler(StatusBarProgreso::OnSize),NULL,this);
        this->GetParent()->Connect(wxEVT_MOVE,wxMoveEventHandler(StatusBarProgreso::OnMove),NULL,this);
        this->Connect(wxEVT_MENSAJES_USUARIO_ASYNC, EventoMensajesUsuarioAsyncHandler(StatusBarProgreso::OnMensajeUsuario), NULL, this);
}
Beispiel #14
0
wxMaximaFrame::wxMaximaFrame(wxWindow* parent, int id, const wxString& title,
                             const wxPoint& pos, const wxSize& size,
                             long style):
    wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
{
  m_manager.SetManagedWindow(this);
  // console
  m_console = new MathCtrl(this, -1, wxDefaultPosition, wxDefaultSize);

  // history
  m_history = new History(this, -1);

  m_plotSlider = NULL;

  SetupMenu();
#if defined (__WXMSW__) || defined (__WXGTK20__) || defined (__WXMAC__)
  SetupToolBar();
#endif


  CreateStatusBar(2);
  int widths[] =
    {
      -1, 300
    };
  SetStatusWidths(2, widths);

#if defined __WXMSW__
  wxAcceleratorEntry entries[0];
  entries[0].Set(wxACCEL_CTRL,  WXK_RETURN, menu_evaluate);
  wxAcceleratorTable accel(1, entries);
  SetAcceleratorTable(accel);
#endif

  set_properties();
  do_layout();

  m_console->SetFocus();
}
Beispiel #15
0
void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
{
    wxCHECK_RET( number > 0, wxT("invalid field number in SetFieldsCount") );

    if ( (size_t)number > m_panes.GetCount() )
    {
        wxStatusBarPane newPane;

        // add more entries with the default style and zero width
        // (this will be set later)
        for (size_t i = m_panes.GetCount(); i < (size_t)number; ++i)
            m_panes.Add(newPane);
    }
    else if ( (size_t)number < m_panes.GetCount() )
    {
        // remove entries in excess
        m_panes.RemoveAt(number, m_panes.GetCount()-number);
    }

    // SetStatusWidths will automatically refresh
    SetStatusWidths(number, widths);
}
Beispiel #16
0
MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxDragImage sample"),
          wxPoint(20,20), wxSize(470,360) )
{
    wxMenu *file_menu = new wxMenu();
    file_menu->Append( wxID_ABOUT, _T("&About..."));
    file_menu->AppendCheckItem( TEST_USE_SCREEN, _T("&Use whole screen for dragging"), _T("Use whole screen"));
    file_menu->Append( wxID_EXIT, _T("E&xit"));

    wxMenuBar *menu_bar = new wxMenuBar();
    menu_bar->Append(file_menu, _T("&File"));

    SetIcon(wxICON(mondrian));
    SetMenuBar( menu_bar );

#if wxUSE_STATUSBAR
    CreateStatusBar(2);
    int widths[] = { -1, 100 };
    SetStatusWidths( 2, widths );
#endif // wxUSE_STATUSBAR

    m_canvas = new MyCanvas( this, wxID_ANY, wxPoint(0,0), wxSize(10,10) );
}
ViewerWindowBase::ViewerWindowBase(ViewerBase *parentViewer, const wxPoint& pos, const wxSize& size) :
    wxFrame(GlobalTopWindow(), wxID_HIGHEST + 10, "", pos, size,
        wxDEFAULT_FRAME_STYLE
#if defined(__WXMSW__)
            | wxFRAME_TOOL_WINDOW
            | wxFRAME_NO_TASKBAR
            | wxFRAME_FLOAT_ON_PARENT
#endif
        ),
    viewerWidget(NULL), viewer(parentViewer)
{
    if (!parentViewer) ERRORMSG("ViewerWindowBase::ViewerWindowBase() - got NULL pointer");

    SetSizeHints(200, 150);
    SetIcon(wxICON(cn3d));

    // status bar with two fields - first is for id/loc, second is for general status line
    CreateStatusBar(2);
    int widths[2] = { 175, -1 };
    SetStatusWidths(2, widths);

    viewerWidget = new SequenceViewerWidget(this);
    SetupFontFromRegistry();

    menuBar = new wxMenuBar;
    viewMenu = new wxMenu;
    viewMenu->Append(MID_SHOW_TITLES, "Show &Titles");
    //menu->Append(MID_HIDE_TITLES, "&Hide Titles");
    viewMenu->Append(MID_SHOW_GEOM_VLTNS, "Show &Geometry Violations", "", true);
    viewMenu->Append(MID_FIND_PATTERN, "Find &Pattern");
    viewMenu->AppendSeparator();
    viewMenu->Append(MID_CACHE_HIGHLIGHTS, "&Cache Highlights");
    viewMenu->Append(MID_RESTORE_CACHED_HIGHLIGHTS, "Rest&ore Cached Highlights");
    menuBar->Append(viewMenu, "&View");

    editMenu = new wxMenu;
    editMenu->Append(MID_ENABLE_EDIT, "&Enable Editor", "", true);
    editMenu->Append(MID_UNDO, "Undo\tCtrl-Z");
#ifndef __WXMAC__
    editMenu->Append(MID_REDO, "Redo\tShift-Ctrl-Z");
#else
    // mac commands apparently don't recognize shift?
    editMenu->Append(MID_REDO, "Redo");
#endif
    editMenu->AppendSeparator();
    editMenu->Append(MID_SPLIT_BLOCK, "&Split Block", "", true);
    editMenu->Append(MID_MERGE_BLOCKS, "&Merge Blocks", "", true);
    editMenu->Append(MID_CREATE_BLOCK, "&Create Block", "", true);
    editMenu->Append(MID_DELETE_BLOCK, "&Delete Block", "", true);
    editMenu->AppendSeparator();
    editMenu->Append(MID_SYNC_STRUCS, "Sy&nc Structure Colors");
    editMenu->Append(MID_SYNC_STRUCS_ON, "&Always Sync Structure Colors", "", true);
    menuBar->Append(editMenu, "&Edit");

    mouseModeMenu = new wxMenu;
    mouseModeMenu->Append(MID_SELECT_RECT, "&Select Rectangle", "", true);
    mouseModeMenu->Append(MID_SELECT_COLS, "Select &Columns", "", true);
    mouseModeMenu->Append(MID_SELECT_ROWS, "Select &Rows", "", true);
    mouseModeMenu->Append(MID_SELECT_BLOCKS, "Select &Blocks", "", true);
    mouseModeMenu->Append(MID_DRAG_HORIZ, "&Horizontal Drag", "", true);
    menuBar->Append(mouseModeMenu, "&Mouse Mode");

    // accelerators for special mouse mode keys
    wxAcceleratorEntry entries[5];
    entries[0].Set(wxACCEL_NORMAL, 's', MID_SELECT_RECT);
    entries[1].Set(wxACCEL_NORMAL, 'c', MID_SELECT_COLS);
    entries[2].Set(wxACCEL_NORMAL, 'r', MID_SELECT_ROWS);
    entries[3].Set(wxACCEL_NORMAL, 'b', MID_SELECT_BLOCKS);
    entries[4].Set(wxACCEL_NORMAL, 'h', MID_DRAG_HORIZ);
    wxAcceleratorTable accel(5, entries);
    SetAcceleratorTable(accel);

    justificationMenu = new wxMenu;
    justificationMenu->Append(MID_LEFT, "&Left", "", true);
    justificationMenu->Append(MID_RIGHT, "&Right", "", true);
    justificationMenu->Append(MID_CENTER, "&Center", "", true);
    justificationMenu->Append(MID_SPLIT, "&Split", "", true);
    menuBar->Append(justificationMenu, "Unaligned &Justification");

    // set default initial modes
    viewerWidget->SetMouseMode(SequenceViewerWidget::eSelectRectangle);
    menuBar->Check(MID_SELECT_RECT, true);
    menuBar->Check(MID_SPLIT, true);
    currentJustification = BlockMultipleAlignment::eSplit;
    viewerWidget->TitleAreaOn();
    menuBar->Check(MID_SYNC_STRUCS_ON, true);
    EnableBaseEditorMenuItems(false);
    menuBar->Check(MID_SHOW_GEOM_VLTNS, false);   // start with gv's off
}
Beispiel #18
0
ComparisonTableView::ComparisonTableView()
	: wxFrame(NULL, wxID_ANY, "Ferret: Table of comparisons", 
		wxDefaultPosition, wxSize (650, 610))
{
	CentreOnScreen ();
	CreateStatusBar(4);
  int widths [] = {-2, -1, -1, -1};
	SetStatusWidths (4, widths);
	SetStatusText("Welcome to Ferret", 0);
	SetStatusText("Documents: ", 1);
	SetStatusText("Pairs: ", 2);
  SetStatusText("Mean: ", 3);
	
	// set up internal widgets
	wxBoxSizer * topsizer = new wxBoxSizer (wxHORIZONTAL);
	
	// 1. comparison table
	wxPanel * docResemblanceView = new wxPanel (this, wxID_ANY);
	wxBoxSizer * resemblanceSizer = new wxBoxSizer (wxVERTICAL);
	docResemblanceView->SetSizer (resemblanceSizer);

	_resemblanceObserver = new DocumentListCtrl (this, docResemblanceView);
	resemblanceSizer->Add (_resemblanceObserver, 1, wxGROW);

	// -- insert three columns
	wxListItem itemCol;
	itemCol.SetText ("Document 1");
	_resemblanceObserver->InsertColumn (0, itemCol);
	_resemblanceObserver->SetColumnWidth (0, wxLIST_AUTOSIZE_USEHEADER);
	itemCol.SetText ("Document 2");
	_resemblanceObserver->InsertColumn (1, itemCol);
	_resemblanceObserver->SetColumnWidth (1, wxLIST_AUTOSIZE_USEHEADER);
	itemCol.SetText ("Similarity");
	_resemblanceObserver->InsertColumn (2, itemCol);
	_resemblanceObserver->SetColumnWidth (2, wxLIST_AUTOSIZE_USEHEADER);

	// 2. buttons 
	// -- note, buttons must be defined before their staticboxsizer, 
	// else tooltips do not display
	wxBoxSizer  * buttonSizer = new wxBoxSizer (wxVERTICAL);
  buttonSizer->Add (MakeButton (this, ID_SAVE_REPORT, "Save Report ...",
        "Save the table of comparisons and other details"),
      0, wxGROW | wxALL, 5);
  buttonSizer->Add (MakeButton (this, ID_UNIQUE_VIEW, "Show Uniqueness", 
        "Show number of unique trigrams per document or group"),
      0, wxGROW | wxALL, 5);
  buttonSizer->Add (MakeButton (this, ID_ENGAGEMENT_VIEW, "Show Engagement", 
        "Show overlap with template material per document or group"),
      0, wxGROW | wxALL, 5);

	wxButton * rank_1 = MakeButton (this, ID_RANK_1, "Document 1",
				"Put table into alphabetical order of first document");
	wxButton * rank_2 = MakeButton (this, ID_RANK_2, "Document 2",
				"Put table into alphabetical order of second document");
	wxButton * rank_r = MakeButton (this, ID_RANK_R, "Similarity",
				"Put table into order with most similar at top");
	wxStaticBoxSizer * rankSizer = new wxStaticBoxSizer (wxVERTICAL, this, "Rearrange table by");
	rankSizer->Add (rank_1, 0, wxGROW | wxALL, 5);
	rankSizer->Add (rank_2, 0, wxGROW | wxALL, 5);
	rankSizer->Add (rank_r, 0, wxGROW | wxALL, 5);
	buttonSizer->Add (rankSizer, 0, wxGROW);

	wxButton * showButton = MakeButton (this, ID_DISPLAY_TEXTS, "Show Analysis",
				"Show selected documents in a separate window");
	wxButton * saveButton = MakeButton (this, ID_CREATE_REPORT, "Save Analysis ...",
				"Save analysis of the selected documents");
	wxStaticBoxSizer * showSizer = new wxStaticBoxSizer (wxVERTICAL, this, "For selected pair");
	showSizer->Add (showButton, 0, wxGROW | wxALL, 5);
	showSizer->Add (saveButton, 0, wxGROW | wxALL, 5);
	buttonSizer->Add (showSizer, 0, wxGROW);

	buttonSizer->AddStretchSpacer (); // separate controls

  buttonSizer->Add (MakeCheckBox (this, ID_REMOVE_COMMON, "Remove Common Trigrams",
      "Compute similarity only from trigrams for the two documents", false), 
      0, wxGROW | wxALL, 5);  
  buttonSizer->Add (MakeCheckBox (this, ID_IGNORE_TEMPLATE, "Ignore Template Material",
      "Compute similarity but ignore any trigrams in template material", false), 
      0, wxGROW | wxALL, 5);  
  buttonSizer->Add (MakeCheckBox (this, ID_SHOW_SHORT, "Show Short Names",
      "Uncheck to show full pathnames in table", true), 
      0, wxGROW | wxALL, 5);

	buttonSizer->AddStretchSpacer (); // separate window controls from Ferret controls
	buttonSizer->Add (new wxButton (this, wxID_HELP), 0, wxGROW | wxALL, 5);
	buttonSizer->Add (new wxButton (this, wxID_EXIT), 0, wxGROW | wxALL, 5);
	
	topsizer->Add (buttonSizer, 0, wxGROW | wxALL, 5);
	topsizer->Insert (0, docResemblanceView, 1, wxGROW);
	
	// compute best minimum height, and constrain window
	int best_height = buttonSizer->GetMinSize().GetHeight () + 40; // allow for space between widgets
	SetSizeHints (best_height, best_height); // keep the minimum size a square shape

	SetSizer (topsizer);
	_resemblanceObserver->SetFocus ();  // give focus to the list control, to show highlighted item

#if __WXMSW__
	SetBackgroundColour (wxNullColour); // ensure background coloured
#endif
}
Beispiel #19
0
void CBaseDialog::UpdateStatusBarText(__StatusPaneEnum nPos, _In_z_ LPCTSTR szMsg)
{
	if (nPos < STATUSBARNUMPANES) m_StatusMessages[nPos] = szMsg;

	SetStatusWidths();
} // CBaseDialog::UpdateStatusBarText
Beispiel #20
0
/* MapEditorWindow::setupLayout
 * Sets up the basic map editor window layout
 *******************************************************************/
void MapEditorWindow::setupLayout()
{
	// Create the wxAUI manager & related things
	wxAuiManager* m_mgr = new wxAuiManager(this);
	m_mgr->SetArtProvider(new SAuiDockArt());
	wxAuiPaneInfo p_inf;

	// Map canvas
	map_canvas = new MapCanvas(this, -1, &editor);
	p_inf.CenterPane();
	m_mgr->AddPane(map_canvas, p_inf);

	// --- Menus ---
	setupMenu();


	// --- Toolbars ---
	toolbar = new SToolBar(this, true);

	// Map toolbar
	SToolBarGroup* tbg_map = new SToolBarGroup(toolbar, "_Map");
	tbg_map->addActionButton("mapw_save");
	tbg_map->addActionButton("mapw_saveas");
	tbg_map->addActionButton("mapw_rename");
	toolbar->addGroup(tbg_map);

	// Mode toolbar
	SToolBarGroup* tbg_mode = new SToolBarGroup(toolbar, "_Mode");
	tbg_mode->addActionButton("mapw_mode_vertices");
	tbg_mode->addActionButton("mapw_mode_lines");
	tbg_mode->addActionButton("mapw_mode_sectors");
	tbg_mode->addActionButton("mapw_mode_things");
	tbg_mode->addActionButton("mapw_mode_3d");
	theApp->toggleAction("mapw_mode_lines");	// Lines mode by default
	toolbar->addGroup(tbg_mode);

	// Flat type toolbar
	SToolBarGroup* tbg_flats = new SToolBarGroup(toolbar, "_Flats Type");
	tbg_flats->addActionButton("mapw_flat_none");
	tbg_flats->addActionButton("mapw_flat_untextured");
	tbg_flats->addActionButton("mapw_flat_textured");
	toolbar->addGroup(tbg_flats);

	// Toggle current flat type
	if (flat_drawtype == 0) theApp->toggleAction("mapw_flat_none");
	else if (flat_drawtype == 1) theApp->toggleAction("mapw_flat_untextured");
	else theApp->toggleAction("mapw_flat_textured");

	// Edit toolbar
	SToolBarGroup* tbg_edit = new SToolBarGroup(toolbar, "_Edit");
	tbg_edit->addActionButton("mapw_draw_lines");
	tbg_edit->addActionButton("mapw_draw_shape");
	tbg_edit->addActionButton("mapw_edit_objects");
	tbg_edit->addActionButton("mapw_mirror_x");
	tbg_edit->addActionButton("mapw_mirror_y");
	toolbar->addGroup(tbg_edit);

	// Extra toolbar
	SToolBarGroup* tbg_misc = new SToolBarGroup(toolbar, "_Misc");
	tbg_misc->addActionButton("mapw_run_map");
	toolbar->addGroup(tbg_misc);

	// Add toolbar
	m_mgr->AddPane(toolbar, wxAuiPaneInfo().Top().CaptionVisible(false).MinSize(-1, SToolBar::getBarHeight()).Resizable(false).PaneBorder(false).Name("toolbar"));


	// Status bar
	CreateStatusBar(4);
	int status_widths[4] = { -1, 240, 200, 160 };
	SetStatusWidths(4, status_widths);

	// -- Console Panel --
	ConsolePanel* panel_console = new ConsolePanel(this, -1);

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Bottom();
	p_inf.Dock();
	p_inf.BestSize(480, 192);
	p_inf.FloatingSize(600, 400);
	p_inf.FloatingPosition(100, 100);
	p_inf.MinSize(-1, 192);
	p_inf.Show(false);
	p_inf.Caption("Console");
	p_inf.Name("console");
	m_mgr->AddPane(panel_console, p_inf);


	// -- Map Object Properties Panel --
	panel_obj_props = new MapObjectPropsPanel(this);

	// Setup panel info & add panel
	p_inf.Right();
	p_inf.BestSize(256, 256);
	p_inf.FloatingSize(400, 600);
	p_inf.FloatingPosition(120, 120);
	p_inf.MinSize(256, 256);
	p_inf.Show(true);
	p_inf.Caption("Item Properties");
	p_inf.Name("item_props");
	m_mgr->AddPane(panel_obj_props, p_inf);


	// --- Script Editor Panel ---
	panel_script_editor = new ScriptEditorPanel(this);

	// Setup panel info & add panel
	p_inf.Float();
	p_inf.BestSize(300, 300);
	p_inf.FloatingSize(500, 400);
	p_inf.FloatingPosition(150, 150);
	p_inf.MinSize(300, 300);
	p_inf.Show(false);
	p_inf.Caption("Script Editor");
	p_inf.Name("script_editor");
	m_mgr->AddPane(panel_script_editor, p_inf);


	// --- Shape Draw Options Panel ---
	ShapeDrawPanel* panel_shapedraw = new ShapeDrawPanel(this);

	// Setup panel info & add panel
	wxSize msize = panel_shapedraw->GetMinSize();
	p_inf.DefaultPane();
	p_inf.Bottom();
	p_inf.Dock();
	p_inf.CloseButton(false);
	p_inf.CaptionVisible(false);
	p_inf.Resizable(false);
	p_inf.Layer(2);
	p_inf.BestSize(msize.x, msize.y);
	p_inf.FloatingSize(msize.x, msize.y);
	p_inf.FloatingPosition(140, 140);
	p_inf.MinSize(msize.x, msize.y);
	p_inf.Show(false);
	p_inf.Caption("Shape Drawing");
	p_inf.Name("shape_draw");
	m_mgr->AddPane(panel_shapedraw, p_inf);


	// --- Object Edit Panel ---
	panel_obj_edit = new ObjectEditPanel(this);

	// Setup panel info & add panel
	msize = panel_obj_edit->GetBestSize();

	p_inf.Bottom();
	p_inf.Dock();
	p_inf.CloseButton(false);
	p_inf.CaptionVisible(false);
	p_inf.Resizable(false);
	p_inf.Layer(2);
	p_inf.BestSize(msize.x, msize.y);
	p_inf.FloatingSize(msize.x, msize.y);
	p_inf.FloatingPosition(140, 140);
	p_inf.MinSize(msize.x, msize.y);
	p_inf.Show(false);
	p_inf.Caption("Object Edit");
	p_inf.Name("object_edit");
	m_mgr->AddPane(panel_obj_edit, p_inf);


	// --- Map Checks Panel ---
	panel_checks = new MapChecksPanel(this, &(editor.getMap()));

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Left();
	p_inf.Dock();
	p_inf.BestSize(400, 300);
	p_inf.FloatingSize(500, 400);
	p_inf.FloatingPosition(160, 160);
	p_inf.MinSize(300, 300);
	p_inf.Show(false);
	p_inf.Caption("Map Checks");
	p_inf.Name("map_checks");
	p_inf.Layer(0);
	m_mgr->AddPane(panel_checks, p_inf);


	// -- Undo History Panel --
	panel_undo_history = new UndoManagerHistoryPanel(this, NULL);
	panel_undo_history->setManager(editor.undoManager());

	// Setup panel info & add panel
	p_inf.DefaultPane();
	p_inf.Right();
	p_inf.BestSize(128, 480);
	p_inf.Caption("Undo History");
	p_inf.Name("undo_history");
	p_inf.Show(false);
	p_inf.Dock();
	m_mgr->AddPane(panel_undo_history, p_inf);


	// Load previously saved window layout
	loadLayout();

	m_mgr->Update();
	Layout();

	// Initial focus on the canvas, so shortcuts work
	map_canvas->SetFocus();
}
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
        const wxString& aTitle, long style ) :
    KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle,
            wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
{
    m_canvas        = NULL;
    m_reloadRequest = false;
    m_ortho         = false;

    // Give it an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
    SetIcon( icon );

    LoadSettings( config() );
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    // Create the status line
    static const int status_dims[4] = { -1, 130, 130, 170 };

    CreateStatusBar( DIM( status_dims ) );
    SetStatusWidths( DIM( status_dims ), status_dims );

    CreateMenuBar();
    ReCreateMainToolbar();

    // Make a EDA_3D_CANVAS
    // Note: We try to use anti aliasing if the graphic card allows that,
    // but only on wxWidgets >= 3.0.0 (this option does not exist on wxWidgets 2.8)
    int attrs[] = { // This array should be 2*n+1
                    // Sadly wxwidgets / glx < 13 allowed
                    // a thing named "boolean attributes" that don't take a value.
                    // (See src/unix/glx11.cpp -> wxGLCanvasX11::ConvertWXAttrsToGL() ).
                    // To avoid problems due to this, just specify those attributes twice.
                    // Only WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_STEREO are such boolean
                    // attributes.

                    // Boolean attributes (using itself at padding):
                    WX_GL_RGBA, WX_GL_RGBA,
                    WX_GL_DOUBLEBUFFER, WX_GL_DOUBLEBUFFER,

                    // Normal attributes with values:
                    WX_GL_DEPTH_SIZE, 16,
                    WX_GL_STENCIL_SIZE, 1,
                    WX_GL_SAMPLE_BUFFERS, 1,    // Enable multisampling support (antialiasing).
                    WX_GL_SAMPLES, 0,           // Disable AA for the start.
                    0 };                        // NULL termination


    // Check if the canvas supports multisampling.
    if( EDA_3D_CANVAS::IsDisplaySupported( attrs ) )
    {
        // Check for possible sample sizes, start form the top.
        int maxSamples = 8; // Any higher doesn't change anything.
        int samplesOffset = 0;

        for( unsigned int ii = 0; ii < DIM( attrs ); ii += 2 )
        {
            if( attrs[ii] == WX_GL_SAMPLES )
            {
                samplesOffset = ii+1;
                break;
            }
        }

        attrs[samplesOffset] = maxSamples;

        for( ; maxSamples > 0 && !EDA_3D_CANVAS::IsDisplaySupported( attrs );
            maxSamples = maxSamples>>1 )
        {
            attrs[samplesOffset] = maxSamples;
        }
    }
    else
    {
        // Disable multisampling
        for( unsigned int ii = 0; ii < DIM( attrs ); ii += 2 )
Beispiel #22
0
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
    KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition,
                  wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{
    m_compListBox           = NULL;
    m_footprintListBox      = NULL;
    m_libListBox            = NULL;
    m_mainToolBar           = NULL;
    m_modified              = false;
    m_isEESchemaNetlist     = false;
    m_KeepCvpcbOpen         = false;
    m_undefinedComponentCnt = 0;
    m_skipComponentSelect   = false;
    m_NetlistFileExtension  = wxT( "net" );

    /* Name of the document footprint list
     * usually located in share/modules/footprints_doc
     * this is of the responsibility to users to create this file
     * if they want to have a list of footprints
     */
    m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME;

    // Give an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
    SetIcon( icon );

    SetAutoLayout( true );

    LoadSettings( config() );

    if( m_FrameSize.x < FRAME_MIN_SIZE_X )
        m_FrameSize.x = FRAME_MIN_SIZE_X;

    if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
        m_FrameSize.y = FRAME_MIN_SIZE_Y;

    // Set minimal frame width and height
    SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );

    // Frame size and position
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    // create the status bar
    static const int dims[3] = { -1, -1, 250 };

    CreateStatusBar( 3 );
    SetStatusWidths( 3, dims );

    ReCreateMenuBar();
    ReCreateHToolbar();

    // Create list of available modules and components of the schematic
    BuildCmpListBox();
    BuildFOOTPRINTS_LISTBOX();
    BuildLIBRARY_LISTBOX();

    m_auimgr.SetManagedWindow( this );

    UpdateTitle();

    EDA_PANEINFO horiz;
    horiz.HorizontalToolbarPane();

    EDA_PANEINFO info;
    info.InfoToolbarPane();


    if( m_mainToolBar )
        m_auimgr.AddPane( m_mainToolBar,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );

    if( m_compListBox )
        m_auimgr.AddPane( m_compListBox,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );

    if( m_libListBox)
        m_auimgr.AddPane( m_libListBox,
                          wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
                          Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );

    if( m_footprintListBox )
        m_auimgr.AddPane( m_footprintListBox,
                          wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
                          Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );

    m_auimgr.Update();
}
Beispiel #23
0
appFrame::appFrame( wxFrame *frame,
					const wxChar *title,
					int x, int y, int w, int h)
                 : wxFrame( frame, -1, title, wxPoint( x, y ), wxSize( w, h ) )
{
		
	m_secondCounter = 0;
	m_pStatusArea = NULL;

	// create the status line
	const int widths[] = { -1, 60, 60 };
	CreateStatusBar( 3 );
	SetStatusWidths( 3, widths );
	wxLogStatus( this, wxT("Simple LIRC CANAL driver test program -  eurosource (http://www.eurosource.se)") );

	///////////////////////////////////////////////////////////////////////////
	//            Persistent storage first time initialization
	///////////////////////////////////////////////////////////////////////////

    // make a panel with some controls
    m_panel = new wxPanel( this, -1, wxPoint( 0, 0 ), wxSize(400, 200), wxTAB_TRAVERSAL);


	m_pStatusArea = new wxStaticText( m_panel, 
										BtnStatusText, 
										wxT("Status Area"),
										wxPoint( 20, 50 ),
										wxSize(800, 30) );

	m_pLogArea = new wxStaticText( m_panel, 
										BtnLogText, 
										wxT("------------------------------------"),
										wxPoint( 20, 50 ),
										wxSize(800, 200) );


    // create buttons for moving the items around
    m_buttonExit = new wxButton( m_panel, BtnExit, wxT("E&xit"), wxPoint( 420, 120 ) );

	// Sizer for the listbox
    wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );


	mainsizer->Add( m_pStatusArea, 0, wxGROW | wxALL, 10 );
	//mainsizer->Add( m_pbar, 0, wxGROW | wxALL, 10 );
	mainsizer->Add( m_pLogArea, 0, wxGROW | wxALL, 10 );

	// Sizer for the buttons
    wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL );

    bottomsizer->Add( m_buttonExit, 0, wxALL, 10 );

    mainsizer->Add( bottomsizer, 0, wxCENTER );

    // tell frame to make use of sizer (or constraints, if any)
    m_panel->SetAutoLayout( TRUE );
    m_panel->SetSizer( mainsizer );

    // don't allow frame to get smaller than what the sizers tell ye
    mainsizer->SetSizeHints( this );

	// Initialize timeevents
	m_timer.SetOwner( this, RefreshTimer );
	m_timer.Start( 100 );  

	// Initialize the LIRC system object
	m_lirc.open("c:\\test.cfg");

    Show( TRUE );

}
Beispiel #24
0
void frmMain::CreateMenus()
{
    // to add a new menu or context menu to the main window, i.e. define a possible
    // action on a pgObject, everything has to go into this method. Doing menu related
    // stuff elsewhere is plain wrong!
    // Create a proper actionFactory  (or contextActionFactory) for each of your new actions 
    // in the new frmXXX.cpp and register it here.

    fileMenu = new wxMenu();
    pluginsMenu = new wxMenu();
    viewMenu = new wxMenu();
    editMenu = new wxMenu();
    newMenu=new wxMenu();
    toolsMenu = new wxMenu();
    slonyMenu=new wxMenu();
    scriptingMenu=new wxMenu();
    viewDataMenu = new wxMenu();
    debuggingMenu=new wxMenu();
    reportMenu=new wxMenu();
    wxMenu *cfgMenu=new wxMenu();
    helpMenu = new wxMenu();
    newContextMenu = new wxMenu();

    toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER );
    toolBar->SetToolBitmapSize(wxSize(32, 32));
    menuFactories = new menuFactoryList();

    // Load plugins - must do this after creating the menus and the factories
    LoadPluginUtilities();

    //--------------------------
    fileMenu->Append(MNU_SAVEDEFINITION, _("&Save Definition..."),_("Save the SQL definition of the selected object."));
    fileMenu->AppendSeparator();
    new addServerFactory(menuFactories, fileMenu, toolBar);

    viewMenu->Append(MNU_OBJECTBROWSER, _("&Object browser\tCtrl-Alt-O"),     _("Show or hide the object browser."), wxITEM_CHECK);
    viewMenu->Append(MNU_SQLPANE, _("&SQL pane\tCtrl-Alt-S"),     _("Show or hide the SQL pane."), wxITEM_CHECK);
    viewMenu->Append(MNU_TOOLBAR, _("&Tool bar\tCtrl-Alt-T"),     _("Show or hide the tool bar."), wxITEM_CHECK);
    viewMenu->AppendSeparator();
    viewMenu->Append(MNU_DEFAULTVIEW, _("&Default view\tCtrl-Alt-V"),     _("Restore the default view."));
    viewMenu->AppendSeparator();
    actionFactory *refFact=new refreshFactory(menuFactories, viewMenu, toolBar);
    new countRowsFactory(menuFactories, viewMenu, 0);
    new executePgstattupleFactory(menuFactories, viewMenu, 0);
    new executePgstatindexFactory(menuFactories, viewMenu, 0);
    new enabledisableRuleFactory(menuFactories, toolsMenu, 0);
    new enabledisableTriggerFactory(menuFactories, toolsMenu, 0);
    new disableAllTriggersFactory(menuFactories, toolsMenu, 0);
    new enableAllTriggersFactory(menuFactories, toolsMenu, 0);
    toolsMenu->AppendSeparator();

    //--------------------------
    new separatorFactory(menuFactories);

    toolBar->AddSeparator();

    new passwordFactory(menuFactories, fileMenu, 0);
    fileMenu->AppendSeparator();
    optionsFactory *optFact=new optionsFactory(menuFactories, fileMenu, 0);
    fileMenu->AppendSeparator();
    new mainConfigFileFactory(menuFactories, fileMenu, 0);
    new hbaConfigFileFactory(menuFactories, fileMenu, 0);
    new pgpassConfigFileFactory(menuFactories, fileMenu, 0);

    fileMenu->AppendSeparator();
    fileMenu->Append(MNU_EXIT, _("E&xit\tCtrl-Q"),                _("Quit this program."));

    new slonyRestartFactory(menuFactories, slonyMenu, 0);
    new slonyUpgradeFactory(menuFactories, slonyMenu, 0);
    new slonyFailoverFactory(menuFactories, slonyMenu, 0);
    new slonyLockSetFactory(menuFactories, slonyMenu, 0);
    new slonyUnlockSetFactory(menuFactories, slonyMenu, 0);
    new slonyMergeSetFactory(menuFactories, slonyMenu, 0);
    new slonyMoveSetFactory(menuFactories, slonyMenu, 0);
    toolsMenu->Append(MNU_SLONY_SUBMENU, _("Replication"), slonyMenu);

    propFactory = new propertyFactory(menuFactories, 0, toolBar);
    new separatorFactory(menuFactories);


    // -------------------------

    editMenu->Append(MNU_COPY, _("&Copy\tCtrl-C"),                _("Copy selected text to clipboard"));
    editMenu->AppendSeparator();

    // -------------------------

    //--------------------------
    
    newMenuFactory = new submenuFactory(menuFactories);     // placeholder where "New objects" submenu will be inserted
    editMenu->Append(newMenuFactory->GetId(), _("New &Object"), newMenu,    _("Create a new object."));
    editMenu->AppendSeparator();


    //--------------------------

    new connectServerFactory(menuFactories, toolsMenu, 0);
    new disconnectServerFactory(menuFactories, toolsMenu, 0);
    new disconnectDatabaseFactory(menuFactories, toolsMenu, 0);

    new startServiceFactory(menuFactories, toolsMenu, 0);
    new stopServiceFactory(menuFactories, toolsMenu, 0);
    new reloadconfServiceFactory(menuFactories, toolsMenu, 0);

    new createFactory(menuFactories, editMenu, toolBar);
    new dropFactory(menuFactories, editMenu, toolBar);
    new dropCascadedFactory(menuFactories, editMenu, 0);
    new truncateFactory(menuFactories, editMenu, 0);
    new truncateCascadedFactory(menuFactories, editMenu, 0);
    new resetTableStatsFactory(menuFactories, editMenu, 0);
    new resetFunctionStatsFactory(menuFactories, editMenu, 0);
    new reassignDropOwnedFactory(menuFactories, editMenu, 0);
    editMenu->AppendSeparator();

    new separatorFactory(menuFactories);

    toolBar->AddSeparator();
    toolsMenu->AppendSeparator();
    
    debuggingMenuFactory = new submenuFactory(menuFactories);     // placeholder where "Debugging" submenu will be inserted
    toolsMenu->Append(debuggingMenuFactory->GetId(), _("&Debugging"), debuggingMenu,    _("Debugging options for the selected item."));
    new debuggerFactory(menuFactories, debuggingMenu, 0);
    new breakpointFactory(menuFactories, debuggingMenu, 0);

    new queryToolFactory(menuFactories, toolsMenu, toolBar);
    scriptingMenuFactory = new submenuFactory(menuFactories);    // placeholder where "Query Template" submenu will be inserted
    toolsMenu->Append(scriptingMenuFactory->GetId(), _("Scripts"), scriptingMenu, _("Start Query Tool with scripted query."));
    new queryToolSqlFactory(menuFactories, scriptingMenu, 0);
    new queryToolSelectFactory(menuFactories, scriptingMenu, 0);
    new queryToolExecFactory(menuFactories, scriptingMenu, 0);
    new queryToolInsertFactory(menuFactories, scriptingMenu, 0);
    new queryToolUpdateFactory(menuFactories, scriptingMenu, 0);
    new queryToolDeleteFactory(menuFactories, scriptingMenu, 0);

    viewdataMenuFactory = new submenuFactory(menuFactories);     // placeholder where "View data" submenu will be inserted
    toolsMenu->Append(viewdataMenuFactory->GetId(), _("View &Data"), viewDataMenu, _("View data."));

    reportMenuFactory = new submenuFactory(menuFactories);     // placeholder where "Reports" submenu will be inserted
    toolsMenu->Append(reportMenuFactory->GetId(), _("&Reports"), reportMenu,    _("Create reports about the selected item."));
    new reportObjectPropertiesFactory(menuFactories, reportMenu, 0);
    new reportObjectDdlFactory(menuFactories, reportMenu, 0);
    new reportObjectDataDictionaryFactory(menuFactories, reportMenu, 0);
    new reportObjectStatisticsFactory(menuFactories, reportMenu, 0);
    new reportObjectDependenciesFactory(menuFactories, reportMenu, 0);
    new reportObjectDependentsFactory(menuFactories, reportMenu, 0);
    new reportObjectListFactory(menuFactories, reportMenu, 0);


    toolsMenu->AppendSeparator();

    new editGridLimitedFactory(menuFactories, viewDataMenu, toolBar, 100, true);
    new editGridLimitedFactory(menuFactories, viewDataMenu, toolBar, 100, false);
    new editGridFactory(menuFactories, viewDataMenu, toolBar);
    new editGridFilteredFactory(menuFactories, viewDataMenu, toolBar);

    new maintenanceFactory(menuFactories, toolsMenu, toolBar);

    new backupFactory(menuFactories, toolsMenu, 0);
    new backupGlobalsFactory(menuFactories, toolsMenu, 0);
    new backupServerFactory(menuFactories, toolsMenu, 0);
    new restoreFactory(menuFactories, toolsMenu, 0);

    new grantWizardFactory(menuFactories, toolsMenu, 0);
    new mainConfigFactory(menuFactories, cfgMenu, 0);
    new hbaConfigFactory(menuFactories, cfgMenu, 0);
    toolsMenu->Append(MNU_CONFIGSUBMENU, _("Server Configuration"), cfgMenu);
    toolsMenu->AppendSeparator();

    new runNowFactory(menuFactories, toolsMenu, 0);
    toolsMenu->AppendSeparator();

    new separatorFactory(menuFactories);

    new propertyFactory(menuFactories, editMenu, 0);
    new serverStatusFactory(menuFactories, toolsMenu, 0);

    // Add the plugin toolbar button/menu
    new pluginButtonMenuFactory(menuFactories, pluginsMenu, toolBar, pluginUtilityCount);

    //--------------------------
    toolBar->AddSeparator();

    actionFactory *helpFact=new contentsFactory(menuFactories, helpMenu, 0);
    new hintFactory(menuFactories, helpMenu, toolBar, true);
    new faqFactory(menuFactories, helpMenu, 0);
    new bugReportFactory(menuFactories, helpMenu, 0);
    
    helpMenu->AppendSeparator();

    new pgsqlHelpFactory(menuFactories, helpMenu, toolBar, true);
    if (!appearanceFactory->GetHideEnterprisedbHelp())
        new edbHelpFactory(menuFactories, helpMenu, toolBar, true);
    if (!appearanceFactory->GetHideGreenplumHelp())
        new greenplumHelpFactory(menuFactories, helpMenu, toolBar, true);
    new slonyHelpFactory(menuFactories, helpMenu, toolBar, true);
    
    // Don't include this seperator on Mac, because the only option
    // under it will be moved to the application menu.
#ifndef __WXMAC__
    helpMenu->AppendSeparator();
#endif

    actionFactory *abFact=new aboutFactory(menuFactories, helpMenu, 0);
    
#ifdef __WXMAC__
    wxApp::s_macPreferencesMenuItemId = optFact->GetId();
    wxApp::s_macExitMenuItemId = MNU_EXIT;
    wxApp::s_macAboutMenuItemId = abFact->GetId();
#else
    (void)optFact;
    (void)abFact;
#endif 


    menuBar = new wxMenuBar();
    menuBar->Append(fileMenu, _("&File"));
    menuBar->Append(editMenu, _("&Edit"));
    // Changing the caption of the plugins menu also needs a similar change below
    menuBar->Append(pluginsMenu, _("&Plugins"));
    menuBar->Append(viewMenu, _("&View"));
    menuBar->Append(toolsMenu, _("&Tools"));
    menuBar->Append(helpMenu, _("&Help"));
    SetMenuBar(menuBar);

    // Disable the plugins menu if there aren't any.
    if (!pluginUtilityCount)
    {
        pluginsMenu->Append(MNU_DUMMY, _("No plugins installed"));
        pluginsMenu->Enable(MNU_DUMMY, false);
    }

    treeContextMenu = 0;

    // Status bar
    statusBar = CreateStatusBar(3);
    int iWidths[3] = {0, -1, 100};
    SetStatusWidths(3, iWidths);
    SetStatusBarPane(-1);
    statusBar->SetStatusText(wxT(""), 0);
    statusBar->SetStatusText(_("Ready."), 1);
    statusBar->SetStatusText(_("0 Secs"), 2);

    wxAcceleratorEntry entries[4];
    entries[0].Set(wxACCEL_NORMAL, WXK_F5, refFact->GetId());
    entries[1].Set(wxACCEL_NORMAL, WXK_DELETE, MNU_DELETE);
    entries[2].Set(wxACCEL_NORMAL, WXK_F1, helpFact->GetId());
    entries[3].Set(wxACCEL_SHIFT, WXK_F10, MNU_CONTEXTMENU);
    wxAcceleratorTable accel(4, entries);

    SetAcceleratorTable(accel);

    // Display the bar and configure buttons. 
    toolBar->Realize();
}
Beispiel #25
0
WinEDA_MainFrame::WinEDA_MainFrame(WinEDA_App * eda_app,
						wxWindow *parent, const wxString & title,
						const wxPoint& pos, const wxSize& size):
		WinEDA_BasicFrame(parent, KICAD_MAIN_FRAME, eda_app, title, pos, size )
{
wxString msg;
wxSize clientsize;

	m_FrameName = wxT("KicadFrame");
	m_VToolBar = NULL;
	m_LeftWin = NULL;
	m_BottomWin = NULL;
	m_CommandWin = NULL;
	m_LeftWin_Width = 200;
	m_CommandWin_Height = 82;

	GetSettings();
	if( m_Parent->m_EDA_Config )
	{
		m_Parent->m_EDA_Config->Read(wxT("LeftWinWidth"), &m_LeftWin_Width);
		m_Parent->m_EDA_Config->Read(wxT("CommandWinWidth"), &m_CommandWin_Height);
	}
	
	SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y);

	// ajuste la ligne de status
int dims[3] = { -1, -1, 100};
	CreateStatusBar(3);
	SetStatusWidths(3,dims);

	// Give an icon
	SetIcon(wxICON(kicad_icon));

	clientsize = GetClientSize();

  // Left window: is the box which display tree project
	m_LeftWin = new WinEDA_PrjFrame(this, wxDefaultPosition, wxDefaultSize);
	m_LeftWin->SetDefaultSize(wxSize(m_LeftWin_Width, clientsize.y));
	m_LeftWin->SetOrientation(wxLAYOUT_VERTICAL);
	m_LeftWin->SetAlignment(wxLAYOUT_LEFT);
	m_LeftWin->SetSashVisible(wxSASH_RIGHT, TRUE);
	m_LeftWin->SetExtraBorderSize(2);

	// Bottom Window: box to display messages
	m_BottomWin = new wxSashLayoutWindow(this, ID_BOTTOM_FRAME,
				wxDefaultPosition, wxDefaultSize,
				wxNO_BORDER|wxSW_3D);
	m_BottomWin->SetDefaultSize(wxSize(clientsize.x, 150));
	m_BottomWin->SetOrientation(wxLAYOUT_HORIZONTAL);
	m_BottomWin->SetAlignment(wxLAYOUT_BOTTOM);
	m_BottomWin->SetSashVisible(wxSASH_TOP, TRUE);
	m_BottomWin->SetSashVisible(wxSASH_LEFT, TRUE);
	m_BottomWin->SetExtraBorderSize(2);

	m_DialogWin = new wxTextCtrl(m_BottomWin, ID_MAIN_DIALOG, wxEmptyString,
				wxDefaultPosition, wxDefaultSize,
				wxTE_MULTILINE|
				wxNO_BORDER|
				wxTE_READONLY);
	m_DialogWin->SetFont(* g_StdFont);

	// m_CommandWin is the box with buttons which launch eechema, pcbnew ...
	m_CommandWin = new WinEDA_CommandFrame(this, ID_MAIN_COMMAND,
				wxPoint(m_LeftWin_Width, 0), wxSize(clientsize.x, m_CommandWin_Height),
				wxNO_BORDER|wxSW_3D);
	m_CommandWin->SetDefaultSize(wxSize(clientsize.x, 100));
	m_CommandWin->SetOrientation(wxLAYOUT_HORIZONTAL);
	m_CommandWin->SetAlignment(wxLAYOUT_TOP);
	m_CommandWin->SetSashVisible(wxSASH_BOTTOM, TRUE);
	m_CommandWin->SetSashVisible(wxSASH_LEFT, TRUE);
	m_CommandWin->SetExtraBorderSize(2);
	m_CommandWin->SetFont(* g_StdFont);

	CreateCommandToolbar();

wxString line;
	msg = wxGetCwd();
	line.Printf( _("Ready\nWorking dir: %s\n"), msg.GetData());
	PrintMsg(line);
}
Beispiel #26
0
EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway,
                              PCB_BASE_FRAME *aParent,
                              const wxString &aTitle,
                              long style ) :

                KIWAY_PLAYER( aKiway,
                              aParent,
                              FRAME_PCB_DISPLAY3D,
                              aTitle,
                              wxDefaultPosition,
                              wxDefaultSize,
                              style,
                              VIEWER3D_FRAMENAME )
{
    wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::EDA_3D_VIEWER %s" ), aTitle );

    m_canvas = NULL;
    m_defaultFileName = "";

    // Give it an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
    SetIcon( icon );

    LoadSettings( config() );
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    // Create the status line
    static const int status_dims[4] = { -1, 130, 130, 170 };

    wxStatusBar *status_bar = CreateStatusBar( DIM( status_dims ) );
    SetStatusWidths( DIM( status_dims ), status_dims );

    CreateMenuBar();
    ReCreateMainToolbar();

    m_canvas = new EDA_3D_CANVAS( this,
                                  COGL_ATT_LIST::GetAttributesList( true ),
                                  aParent->GetBoard(),
                                  m_settings,
                                  Prj().Get3DCacheManager() );

    if( m_canvas )
        m_canvas->SetStatusBar( status_bar );

    m_auimgr.SetManagedWindow( this );

    EDA_PANEINFO horiztb;
    horiztb.HorizontalToolbarPane();

    m_auimgr.AddPane( m_mainToolBar,
                      wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() );

    if( m_canvas )
        m_auimgr.AddPane( m_canvas,
                          wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );

    m_auimgr.Update();

    m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW,
                               (m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) );

    // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
    // in order to receive mouse events.  Otherwise, the user has to click somewhere on
    // the canvas before it will respond to mouse wheel events.
    if( m_canvas )
        m_canvas->SetFocus();
}
Beispiel #27
0
void wxStatusBarBase::SetFieldsCount(int number, const int *widths)
{
    wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") );

    bool refresh = false;

    if ( number != m_nFields )
    {
        // copy stacks if present
        if(m_statusTextStacks)
        {
            wxListString **newStacks = new wxListString*[number];
            size_t i, j, max = wxMin(number, m_nFields);

            // copy old stacks
            for(i = 0; i < max; ++i)
                newStacks[i] = m_statusTextStacks[i];
            // free old stacks in excess
            for(j = i; j < (size_t)m_nFields; ++j)
            {
                if(m_statusTextStacks[j])
                {
                    m_statusTextStacks[j]->Clear();
                    delete m_statusTextStacks[j];
                }
            }
            // initialize new stacks to NULL
            for(j = i; j < (size_t)number; ++j)
                newStacks[j] = 0;

            m_statusTextStacks = newStacks;
        }

        // Resize styles array
        if (m_statusStyles)
        {
            int *oldStyles = m_statusStyles;
            m_statusStyles = new int[number];
            int i, max = wxMin(number, m_nFields);

            // copy old styles
            for (i = 0; i < max; ++i)
                m_statusStyles[i] = oldStyles[i];

            // initialize new styles to wxSB_NORMAL
            for (i = max; i < number; ++i)
                m_statusStyles[i] = wxSB_NORMAL;

            // free old styles
            delete [] oldStyles;
        }


        m_nFields = number;

        ReinitWidths();

        refresh = true;
    }
    //else: keep the old m_statusWidths if we had them

    if ( widths )
    {
        SetStatusWidths(number, widths);

        // already done from SetStatusWidths()
        refresh = false;
    }

    if ( refresh )
        Refresh();
}
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
                                FRAME_T aFrameType,
                                const wxString& aTitle,
                                const wxPoint& aPos, const wxSize& aSize,
                                long aStyle, const wxString & aFrameName ) :
    KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{
    m_file_checker        = NULL;

    m_drawToolBar         = NULL;
    m_optionsToolBar      = NULL;
    m_gridSelectBox       = NULL;
    m_zoomSelectBox       = NULL;
    m_HotkeysZoomAndGridList = NULL;

    m_canvas              = NULL;
    m_galCanvas           = NULL;
    m_galCanvasActive     = false;
    m_messagePanel        = NULL;
    m_currentScreen       = NULL;
    m_toolId              = ID_NO_TOOL_SELECTED;
    m_lastDrawToolId      = ID_NO_TOOL_SELECTED;
    m_showAxis            = false;      // true to draw axis.
    m_showBorderAndTitleBlock = false;  // true to display reference sheet.
    m_showGridAxis        = false;      // true to draw the grid axis
    m_showOriginAxis      = false;      // true to draw the grid origin
    m_cursorShape         = 0;
    m_LastGridSizeId      = 0;
    m_drawGrid            = true;       // hide/Show grid. default = show
    m_gridColor           = DARKGRAY;   // Default grid color
    m_showPageLimits      = false;
    m_drawBgColor         = BLACK;      // the background color of the draw canvas:
                                        // BLACK for Pcbnew, BLACK or WHITE for eeschema
    m_snapToGrid          = true;
    m_MsgFrameHeight      = EDA_MSG_PANEL::GetRequiredHeight();
    m_movingCursorWithKeyboard = false;

    m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);

    CreateStatusBar( 6 );

    // set the size of the status bar subwindows:

    wxWindow* stsbar = GetStatusBar();

    int dims[] = {

        // remainder of status bar on far left is set to a default or whatever is left over.
        -1,

        // When using GetTextSize() remember the width of character '1' is not the same
        // as the width of '0' unless the font is fixed width, and it usually won't be.

        // zoom:
        GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,

        // cursor coords
        GetTextSize( wxT( "X 0234.567890  Y 0234.567890" ), stsbar ).x + 10,

        // delta distances
        GetTextSize( wxT( "dx 0234.567890  dx 0234.567890  d 0234.567890" ), stsbar ).x + 10,

        // units display, Inches is bigger than mm
        GetTextSize( _( "Inches" ), stsbar ).x + 10,

        // Size for the panel used as "Current tool in play": will take longest string from
        // void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
        GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
    };

    SetStatusWidths( DIM( dims ), dims );

    // Create child subwindows.
    GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
    m_FramePos.x   = m_FramePos.y = 0;
    m_FrameSize.y -= m_MsgFrameHeight;

    m_canvas = new EDA_DRAW_PANEL( this, -1, wxPoint( 0, 0 ), m_FrameSize );
    m_messagePanel  = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
                                         wxSize( m_FrameSize.x, m_MsgFrameHeight ) );

    m_messagePanel->SetBackgroundColour( MakeColour( LIGHTGRAY ) );
}
KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
        const wxString& title, const wxPoint&  pos, const wxSize&   size ) :
    EDA_BASE_FRAME( parent, KICAD_MAIN_FRAME_T, title, pos, size,
                    KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "KicadFrame" ) )
{
    m_leftWinWidth = 60;

    // Create the status line (bottom of the frame
    static const int dims[3] = { -1, -1, 100 };

    CreateStatusBar( 3 );
    SetStatusWidths( 3, dims );

    // Give an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_kicad_xpm ) );
    SetIcon( icon );

    // Give the last sise and pos to main window
    LoadSettings( config() );
    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    // Left window: is the box which display tree project
    m_LeftWin = new TREE_PROJECT_FRAME( this );

    // Right top Window: buttons to launch applications
    m_Launcher = new LAUNCHER_PANEL( this );

    // Add the wxTextCtrl showing all messages from KiCad:
    m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
                                    wxDefaultPosition, wxDefaultSize,
                                    wxTE_MULTILINE | wxSUNKEN_BORDER | wxTE_READONLY );

    RecreateBaseHToolbar();
    ReCreateMenuBar();

    m_auimgr.SetManagedWindow( this );

    EDA_PANEINFO horiztb;
    horiztb.HorizontalToolbarPane();

    EDA_PANEINFO info;
    info.InfoToolbarPane();

    m_auimgr.AddPane( m_mainToolBar,
                      wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() );

    m_auimgr.AddPane( m_LeftWin,
                      wxAuiPaneInfo(info).Name( wxT( "m_LeftWin" ) ).Left().
                      BestSize( m_leftWinWidth, -1 ).
                      Layer( 1 ) );

    m_auimgr.AddPane( m_Launcher, wxTOP );
    m_auimgr.GetPane( m_Launcher).CaptionVisible( false ).Row(1)
        .BestSize( -1, m_Launcher->GetPanelHeight() ).PaneBorder( false ).Resizable( false );

    m_auimgr.AddPane( m_MessagesBox,
                      wxAuiPaneInfo().Name( wxT( "m_MessagesBox" ) ).CentrePane().Layer( 2 ) );

    m_auimgr.GetPane( m_LeftWin ).MinSize( wxSize( 80, -1) );
    m_auimgr.GetPane( m_LeftWin ).BestSize(wxSize(m_leftWinWidth, -1) );

    m_auimgr.Update();
}
Beispiel #30
0
frmDatabaseDesigner::frmDatabaseDesigner(frmMain *form, const wxString &_title, pgConn *conn)
	: pgFrame(NULL, _title)
{
	mainForm = form;
	SetTitle(wxT("Database Designer"));
	SetIcon(wxIcon(*ddmodel_32_png_ico));
	loading = true;
	closing = false;

	RestorePosition(100, 100, 600, 500, 450, 300);
	SetMinSize(wxSize(450, 300));

	// connection
	connection = conn;

	// notify wxAUI which frame to use
	manager.SetManagedWindow(this);
	manager.SetFlags(wxAUI_MGR_DEFAULT | wxAUI_MGR_TRANSPARENT_DRAG);

	wxWindowBase::SetFont(settings->GetSystemFont());

	// Set File menu
	fileMenu = new wxMenu();
	fileMenu->Append(MNU_NEW, _("&New database design\tCtrl-N"), _("Create a new database design"));
	fileMenu->AppendSeparator();
	fileMenu->Append(MNU_LOADMODEL, _("&Open Model..."), _("Open an existing database design from a file"));
	fileMenu->Append(MNU_SAVEMODEL, _("&Save Model"), _("Save changes at database design"));
	fileMenu->Append(MNU_SAVEMODELAS, _("&Save Model As..."), _("Save database design at new file"));
	fileMenu->AppendSeparator();
	fileMenu->Append(CTL_IMPSCHEMA, _("&Import Tables..."), _("Import tables from database schema to database designer model"));
	fileMenu->AppendSeparator();
	fileMenu->Append(MNU_EXIT, _("E&xit\tCtrl-W"), _("Exit database designer window"));

	// Set Diagram menu
	diagramMenu = new wxMenu();
	diagramMenu->Append(MNU_NEWDIAGRAM, _("&New model diagram"), _("Create a new diagram"));
	diagramMenu->Append(MNU_DELDIAGRAM, _("&Delete selected model diagram..."), _("Delete selected diagram"));
	diagramMenu->Append(MNU_RENDIAGRAM, _("&Rename selected model diagram..."), _("Rename selected diagram"));

	// Set View menu
	viewMenu = new wxMenu();
	viewMenu->AppendCheckItem(MNU_TOGGLEMBROWSER, _("&Model Browser"), _("Show / Hide Model Browser Window"));
	viewMenu->AppendCheckItem(MNU_TOGGLEDDSQL, _("&SQL Window"), _("Show / Hide SQL Window"));
	viewMenu->Check(MNU_TOGGLEDDSQL, true);
	viewMenu->Check(MNU_TOGGLEMBROWSER, true);

	// Set Help menu
	helpMenu = new wxMenu();
	helpMenu->Append(MNU_CONTENTS, _("&Help"), _("Open the helpfile."));
	helpMenu->Append(MNU_HELP, _("&SQL Help\tF1"), _("Display help on SQL commands."));

	// Set menu bar
	menuBar = new wxMenuBar();
	menuBar->Append(fileMenu, _("&File"));
	menuBar->Append(diagramMenu, _("&Diagram"));
	menuBar->Append(viewMenu, _("&View"));
	menuBar->Append(helpMenu, _("&Help"));
	SetMenuBar(menuBar);

	// Set status bar
	int iWidths[6] = {0, -1, 40, 150, 80, 80};
	CreateStatusBar(6);
	SetStatusBarPane(-1);
	SetStatusWidths(6, iWidths);

	// Set toolbar
	toolBar = new ctlMenuToolbar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_FLAT | wxTB_NODIVIDER);
	toolBar->SetToolBitmapSize(wxSize(16, 16));
	toolBar->AddTool(MNU_NEW, _("New Model"), *file_new_png_bmp, _("Create new model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_NEWDIAGRAM, _("New Diagram"), *ddnewdiagram_png_bmp, _("Add new diagram"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_LOADMODEL, _("Open Model"), *file_open_png_bmp, _("Open existing model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_SAVEMODEL, _("Save Model"), *file_save_png_bmp, _("Save current model"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_ADDTABLE, _("Add Table"), *table_png_bmp, _("Add empty table to the current model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_DELETETABLE, _("Delete Table"), wxBitmap(*ddRemoveTable2_png_img), _("Delete selected table"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_ADDCOLUMN, _("Add Column"), *table_png_bmp, _("Add new column to the selected table"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_GENERATEMODEL, _("Generate Model"), *continue_png_bmp, _("Generate SQL for the current model"), wxITEM_NORMAL);
	toolBar->AddTool(MNU_GENERATEDIAGRAM, _("Generate Diagram"), *ddgendiagram_png_bmp, _("Generate SQL for the current diagram"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(CTL_IMPSCHEMA, _("Import Tables from database..."), *conversion_png_ico, _("Import tables from database schema to database designer model"), wxITEM_NORMAL);
	toolBar->AddSeparator();
	toolBar->AddTool(MNU_HELP, _("Help"), *help_png_bmp, _("Display help"), wxITEM_NORMAL);
	toolBar->Realize();

	// Create notebook for diagrams
	diagrams = new ctlAuiNotebook(this, CTL_DDNOTEBOOK, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_CLOSE_ON_ALL_TABS);

	// Now, the scratchpad
	sqltext = new ctlSQLBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSIMPLE_BORDER | wxTE_RICH2);

	//Now, the Objects Browser
	wxSizer *browserSizer = new wxBoxSizer(wxHORIZONTAL);
	browserPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);

	// Add the database designer
	design = new ddDatabaseDesign(diagrams, this);

	// Create database model browser
	modelBrowser = new ddModelBrowser(browserPanel, DD_BROWSER, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS | wxSIMPLE_BORDER, design);
	design->registerBrowser(modelBrowser);

	// Set browser Sizers
	browserSizer->Add(modelBrowser, 1, wxEXPAND);
	browserPanel->SetSizer(browserSizer);
	browserSizer->SetSizeHints(browserPanel);

	// Add view to notebook
	diagrams->AddPage(design->createDiagram(diagrams, _("unnamed"), false)->getView(), _("unnamed"));


	// Add the database selection bar and schema selector
	wxSizer *connectionSizer = new wxBoxSizer(wxHORIZONTAL);
	connectionPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, -1));
	cbConnection = new wxBitmapComboBox(connectionPanel, CTL_DDCONNECTION, wxEmptyString, wxDefaultPosition, wxSize(-1, -1), wxArrayString(), wxCB_READONLY | wxCB_DROPDOWN);
	if(conn)
		cbConnection->Append(conn->GetName(), CreateBitmap(GetServerColour(conn)), (void *)conn);
	cbConnection->Append(_("<new connection>"), wxNullBitmap, (void *) NULL);

	connectionSizer->Add(cbConnection, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 1);
	connectionSizer->AddSpacer(5);
	connectionPanel->SetSizer(connectionSizer);
	connectionSizer->SetSizeHints(connectionPanel);


	// Add the panes
	manager.AddPane(diagrams,
	                wxAuiPaneInfo().Center().
	                Name(wxT("sqlQuery")).Caption(_("Database Designer")).
	                CaptionVisible(true).CloseButton(false).MaximizeButton(true).
	                Dockable(true).Movable(true));
	manager.AddPane(browserPanel,
	                wxAuiPaneInfo().Left().
	                Name(wxT("ModelBrowser")).Caption(_("Model Browser")).
	                CaptionVisible(true).CloseButton(true).MinimizeButton(true).
	                MinSize(wxSize(140, 100)).BestSize(wxSize(200, 200)));
	manager.AddPane(sqltext,
	                wxAuiPaneInfo().Bottom().
	                Name(wxT("sqlText")).Caption(_("SQL query")).
	                CaptionVisible(true).CloseButton(true).MaximizeButton(true).MinimizeButton(true).
	                MinSize(wxSize(200, 100)).BestSize(wxSize(350, 150)));
	manager.AddPane(toolBar,
	                wxAuiPaneInfo().Top().
	                Name(wxT("toolBar")).Caption(_("Tool bar")).
	                ToolbarPane().
	                LeftDockable(false).RightDockable(false));
	manager.AddPane(connectionPanel, wxAuiPaneInfo().Name(wxT("databaseBar"))
	                .Caption(_("Connection bar")).ToolbarPane().Top().
	                LeftDockable(false).RightDockable(false));

	// Update the AUI manager
	manager.Update();

	//Update browser info
	modelBrowser->SetSize(browserPanel->GetSize());

	previousChanged = true;
	setModelChanged(false);
	SetStatusText(wxString(wxT("Ready")), 1);
}