Exemplo n.º 1
0
/* SToolBar::SToolBar
 * SToolBar class constructor
 *******************************************************************/
SToolBar::SToolBar(wxWindow* parent, bool main_toolbar) : wxPanel(parent, -1)
{
	// Init variables
	min_height = 0;
	n_rows = 0;
	draw_border = true;
	this->main_toolbar = main_toolbar;

	// Enable double buffering to avoid flickering
#ifdef __WXMSW__
	// In Windows, only enable on Vista or newer
	if (Global::win_version_major >= 6)
		SetDoubleBuffered(true);
#elif !defined __WXMAC__
	SetDoubleBuffered(true);
#endif

	// Set background colour
	SetBackgroundColour((main_toolbar && Global::win_version_major >= 10) ? wxColor(250, 250, 250) : Drawing::getPanelBGColour());

	// Create sizer
	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
	SetSizer(sizer);

	// Bind events
	Bind(wxEVT_SIZE, &SToolBar::onSize, this);
	Bind(wxEVT_PAINT, &SToolBar::onPaint, this);
	Bind(wxEVT_KILL_FOCUS, &SToolBar::onFocus, this);
	Bind(wxEVT_RIGHT_DOWN, &SToolBar::onMouseEvent, this);
	Bind(wxEVT_LEFT_DOWN, &SToolBar::onMouseEvent, this);
	Bind(wxEVT_MENU, &SToolBar::onContextMenu, this);
	Bind(wxEVT_ERASE_BACKGROUND, &SToolBar::onEraseBackground, this);
}
Exemplo n.º 2
0
SToolBar::SToolBar(wxWindow* parent) : wxPanel(parent, -1)
{
	// Init variables
	min_height = 0;
	n_rows = 0;
	draw_border = true;

	// Enable double buffering to avoid flickering
#ifdef __WXMSW__
	// In Windows, only enable on Vista or newer
	int win_vers;
	wxGetOsVersion(&win_vers);
	if (win_vers >= 6)
		SetDoubleBuffered(true);
#else
	SetDoubleBuffered(true);
#endif

	// Set background colour
	SetBackgroundColour(Drawing::getPanelBGColour());

	// Create sizer
	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
	SetSizer(sizer);

	// Bind events
	Bind(wxEVT_SIZE, &SToolBar::onSize, this);
	Bind(wxEVT_PAINT, &SToolBar::onPaint, this);
	Bind(wxEVT_KILL_FOCUS, &SToolBar::onFocus, this);
	Bind(wxEVT_RIGHT_DOWN, &SToolBar::onMouseEvent, this);
	Bind(wxEVT_LEFT_DOWN, &SToolBar::onMouseEvent, this);
	Bind(wxEVT_MENU, &SToolBar::onContextMenu, this);
	Bind(wxEVT_ERASE_BACKGROUND, &SToolBar::onEraseBackground, this);
}
Exemplo n.º 3
0
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu)
	: wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER_NONE|wxVSCROLL), cpu(_cpu)
{
	rowHeight = getDebugFontHeight()+2;
	charWidth = getDebugFontWidth();
	category  = 0;
	maxBits   = 128;
	lastPc    = 0xFFFFFFFF;

	for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
	{
		int count = cpu->getRegisterCount(i);

		ChangedReg* regs = new ChangedReg[count];
		memset(regs,0,sizeof(ChangedReg)*count);
		changedCategories.push_back(regs);

		int maxLen = 0;
		for (int k = 0; k < cpu->getRegisterCount(i); k++)
		{
			maxLen = std::max<int>(maxLen,strlen(cpu->getRegisterName(i,k)));
		}

		int x = 17+(maxLen+2)*charWidth;
		startPositions.push_back(x);
		currentRows.push_back(0);
	}

	SetDoubleBuffered(true);
	SetInitialSize(ClientToWindowSize(GetMinClientSize()));

	wxSize actualSize = getOptimalSize();
	SetVirtualSize(actualSize);
	SetScrollbars(1, rowHeight, actualSize.x, actualSize.y / rowHeight, 0, 0);
}
Exemplo n.º 4
0
/* SCallTip::SCallTip
 * SCallTip class constructor
 *******************************************************************/
SCallTip::SCallTip(wxWindow* parent)
	: wxPopupWindow(parent),
	col_bg(240, 240, 240),
	col_fg(240, 240, 240),
	function(NULL),
	arg_current(-1),
	switch_args(false),
	btn_mouse_over(0),
	buffer(1000, 1000, 32)
{
	font = GetFont();

	Show(false);

#ifndef __WXOSX__
	SetDoubleBuffered(true);
#endif // !__WXOSX__

	// Bind events
	Bind(wxEVT_PAINT, &SCallTip::onPaint, this);
	Bind(wxEVT_ERASE_BACKGROUND, &SCallTip::onEraseBackground, this);
	Bind(wxEVT_MOTION, &SCallTip::onMouseMove, this);
	Bind(wxEVT_LEFT_DOWN, &SCallTip::onMouseDown, this);
	Bind(wxEVT_SHOW, &SCallTip::onShow, this);
}
Exemplo n.º 5
0
SearchWindow::SearchWindow(MainFrame* mainFrame, wxWindowID winid)
    : wxTextCtrl(mainFrame, winid, _(""), wxDefaultPosition, wxSize(200,150), 
		wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP | wxTE_RICH | wxBORDER_NONE)
{
	SetDoubleBuffered(true);
    m_mainFrame = mainFrame;
}
Exemplo n.º 6
0
TimeLogChart::TimeLogChart(wxWindow *parent, int id, const wxString& title):
    wxPanel(parent, id), m_title(title)
{
    InitDefaults();
    SetDoubleBuffered(true);
    Connect(wxEVT_PAINT, wxPaintEventHandler(TimeLogChart::OnPaint));
    Connect(wxEVT_SIZE, wxSizeEventHandler(TimeLogChart::OnSize));
}
Exemplo n.º 7
0
CSimplePanelBase::CSimplePanelBase( wxWindow* parent ) :
    wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN | wxBORDER_NONE )
{
#ifdef __WXMSW__
    SetDoubleBuffered(true);
#endif

#ifdef __WXMAC__
    // Tell accessibility aids to ignore this panel (but not its contents)
    HIObjectSetAccessibilityIgnored((HIObjectRef)GetHandle(), true);
#endif
}
Exemplo n.º 8
0
// ----------------------------------------------------------------------------
// SBPanel - parent control is the parent for all the status bar items
//
SBPanel::SBPanel(wxStatusBar* parent, const wxSize& panelSize)
    : wxPanel(parent, wxID_ANY, wxDefaultPosition, panelSize)
{
    int txtHeight;

    fieldOffsets.reserve(12);
    parent->GetTextExtent("M", &emWidth, &txtHeight);       // Horizontal spacer used by various controls
    SetBackgroundStyle(wxBG_STYLE_PAINT);

#ifndef __APPLE__
    SetDoubleBuffered(true);
#endif
}
Exemplo n.º 9
0
wxStatusBarEx::wxStatusBarEx(wxTopLevelWindow* pParent)
{
	m_pParent = pParent;
	m_columnWidths = 0;
	Create(pParent, wxID_ANY);

#ifdef __WXMSW__
	m_parentWasMaximized = false;

	if (GetLayoutDirection() != wxLayout_RightToLeft)
		SetDoubleBuffered(true);
#endif
}
Exemplo n.º 10
0
PlayerWindow::PlayerWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
{
    _image = wxImage(size, true);
	SetDoubleBuffered(true);
    _dragging = false;
	
	Create(parent, id, "Player Window", pos , size, wxBORDER_NONE, _T("id"));
	SetClientSize(size);
	Move(pos);
    wxWindow::Show();

    Connect(wxEVT_LEFT_DOWN, (wxObjectEventFunction)&PlayerWindow::OnMouseLeftDown, 0, this);
    Connect(wxEVT_LEFT_UP, (wxObjectEventFunction)&PlayerWindow::OnMouseLeftUp, 0, this);
    Connect(wxEVT_MOTION, (wxObjectEventFunction)&PlayerWindow::OnMouseMove, 0, this);
    Connect(wxEVT_PAINT, (wxObjectEventFunction)&PlayerWindow::Paint, 0, this);
}
Exemplo n.º 11
0
Sidebar::Sidebar(wxWindow *parent, wxMenu *suggestionsMenu)
    : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER | DoubleBufferingWindowStyle()),
      m_catalog(nullptr),
      m_selectedItem(nullptr)
{
    SetBackgroundColour(SIDEBAR_BACKGROUND);
#ifdef __WXMSW__
    if (!IsWindowsXP())
        SetDoubleBuffered(true);
#endif

    Bind(wxEVT_PAINT, &Sidebar::OnPaint, this);
#ifdef __WXOSX__
    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
#endif

    auto *topSizer = new wxBoxSizer(wxVERTICAL);
    topSizer->SetMinSize(wxSize(PX(300), -1));

    m_blocksSizer = new wxBoxSizer(wxVERTICAL);
    topSizer->Add(m_blocksSizer, wxSizerFlags(1).Expand().PXDoubleBorder(wxTOP|wxBOTTOM));

    m_topBlocksSizer = new wxBoxSizer(wxVERTICAL);
    m_bottomBlocksSizer = new wxBoxSizer(wxVERTICAL);

    m_blocksSizer->Add(m_topBlocksSizer, wxSizerFlags(1).Expand().ReserveSpaceEvenIfHidden());
    m_blocksSizer->Add(m_bottomBlocksSizer, wxSizerFlags().Expand());

    AddBlock(new SuggestionsSidebarBlock(this, suggestionsMenu), Top);
    AddBlock(new OldMsgidSidebarBlock(this), Bottom);
    AddBlock(new ExtractedCommentSidebarBlock(this), Bottom);
    AddBlock(new CommentSidebarBlock(this), Bottom);
    AddBlock(new AddCommentSidebarBlock(this), Bottom);

    SetSizerAndFit(topSizer);

    SetSelectedItem(nullptr, nullptr);
}
Exemplo n.º 12
0
CFilelistStatusBar::CFilelistStatusBar(wxWindow* pParent)
	: wxStatusBar(pParent, wxID_ANY, 0)
{
	m_count_files = 0;
	m_count_dirs = 0;
	m_total_size = 0;
	m_unknown_size = false;
	m_hidden = false;

	m_count_selected_files = 0;
	m_count_selected_dirs = 0;
	m_total_selected_size = 0;
	m_unknown_selected_size = 0;

	m_updateTimer.SetOwner(this);

	UpdateText();

#ifdef __WXMSW__
	if (GetLayoutDirection() != wxLayout_RightToLeft)
		SetDoubleBuffered(true);
#endif
}
Exemplo n.º 13
0
CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB* symboldb, wxWindow* parent,
                     wxWindowID Id)
    : wxControl(parent, Id), m_debugger(debuginterface), m_symbol_db(symboldb), m_plain(false),
      m_curAddress(debuginterface->GetPC()), m_align(debuginterface->GetInstructionSize(0)),
      m_rowHeight(FromDIP(13)), m_left_col_width(FromDIP(LEFT_COL_WIDTH)), m_selection(0),
      m_oldSelection(0), m_selecting(false)
{
  Bind(wxEVT_PAINT, &CCodeView::OnPaint, this);
  Bind(wxEVT_MOUSEWHEEL, &CCodeView::OnScrollWheel, this);
  Bind(wxEVT_LEFT_DOWN, &CCodeView::OnMouseDown, this);
  Bind(wxEVT_LEFT_UP, &CCodeView::OnMouseUpL, this);
  Bind(wxEVT_MOTION, &CCodeView::OnMouseMove, this);
  Bind(wxEVT_RIGHT_DOWN, &CCodeView::OnMouseDown, this);
  Bind(wxEVT_RIGHT_UP, &CCodeView::OnMouseUpR, this);
  Bind(wxEVT_MENU, &CCodeView::OnPopupMenu, this);
  Bind(wxEVT_SIZE, &CCodeView::OnResize, this);

  // Disable the erase event, the entire window is being painted so the erase
  // event will just cause unnecessary flicker.
  SetBackgroundStyle(wxBG_STYLE_PAINT);
#if defined(__WXMSW__) || defined(__WXGTK__)
  SetDoubleBuffered(true);
#endif
}
Exemplo n.º 14
0
DBTreeCtrl::DBTreeCtrl(
		wxWindow* frame,
		wxWindow* parent,
		wxWindowID id,
		const wxPoint& pos,
		const wxSize& size,
		long style) :
	wxTreeCtrl(parent, id, pos, size, style),
	m_frame(frame)
{
	wxImageList *images = new wxImageList(24, 24, true);
	wxIcon icons[3];
	icons[0] = wxIcon(cube_xpm);
	icons[1] = wxIcon(folder_xpm);
	icons[2] = wxIcon(database_xpm);
	images->Add(icons[0]);
	images->Add(icons[1]);
	images->Add(icons[2]);
	AssignImageList(images);
	SetDoubleBuffered(true); 

//	ExpandAll();
//	ScrollTo(item);
}
Exemplo n.º 15
0
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu)
	: wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER), cpu(_cpu)
{
	rowHeight = 14;
	charWidth = 8;
	category = 0;
	maxBits = 128;

	for (int i = 0; i < cpu->getRegisterCategoryCount(); i++)
	{
		int count = cpu->getRegisterCount(i);

		ChangedReg* regs = new ChangedReg[count];
		memset(regs,0,sizeof(ChangedReg)*count);
		changedCategories.push_back(regs);

		int maxLen = 0;
		for (int k = 0; k < cpu->getRegisterCount(i); k++)
		{
			maxLen = std::max<int>(maxLen,strlen(cpu->getRegisterName(i,k)));
		}

		int x = 17+(maxLen+3)*charWidth;
		startPositions.push_back(x);
		currentRows.push_back(0);
	}

	menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY32,		L"Display 32 bit");
	menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY64,		L"Display 64 bit");
	menu.AppendRadioItem(ID_REGISTERLIST_DISPLAY128,	L"Display 128 bit");
	menu.Check(ID_REGISTERLIST_DISPLAY128,true);
	menu.Connect(wxEVT_COMMAND_MENU_SELECTED, (wxObjectEventFunction)&CtrlRegisterList::onPopupClick, NULL, this);

	SetDoubleBuffered(true);
	SetInitialBestSize(ClientToWindowSize(GetMinClientSize()));
}
Exemplo n.º 16
0
/* Constructor */
CDlgDiagnosticLogFlags::CDlgDiagnosticLogFlags(wxWindow* parent) :
    wxDialog( parent, ID_ANYDIALOG, wxEmptyString, wxDefaultPosition,
                wxSize( DLGDIAGNOSTICS_INITIAL_WIDTH,DLGDIAGNOSTICS_INITIAL_HEIGHT ),
                wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
            ) {

    CSkinAdvanced*     pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    CMainDocument* pDoc = wxGetApp().GetDocument();

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));

    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));

    wxString title;
    title.Printf(
        _("%s Diagnostic Log Flags"),
        pSkinAdvanced->GetApplicationShortName().c_str()
    );

    SetTitle(title);

    // Get cc_config.xml file flags
    log_flags.init();
    m_cc_config.defaults();
    pDoc->rpc.get_cc_config(m_cc_config, log_flags);
    
    SetSizeHints(DLGDIAGNOSTICS_MIN_WIDTH, DLGDIAGNOSTICS_MIN_HEIGHT);
    SetExtraStyle( GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
    
    wxBoxSizer* bSizer1 = new wxBoxSizer( wxVERTICAL );
    m_headingSizer = new wxFlexGridSizer( 1 );
    
    m_headingText.Printf(
        _("These flags enable various types of diagnostic messages in the Event Log.")
    );
    
    m_heading = new wxStaticText(this, wxID_ANY, m_headingText);

    m_headingSizer->Add(m_heading, 1, wxLEFT | wxRIGHT, 25);

    wxString strURL = pSkinAdvanced->GetOrganizationHelpUrl();
    wxString helpURL;
    helpURL.Printf(
            wxT("%s?target=notice&controlid=log_flags"),
            strURL.c_str()
        );

     m_headingSizer->Add(
        new wxHyperlinkCtrl(
            this, wxID_ANY, _("More info ..."), helpURL,
            wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE
        ),
        0, wxLEFT | wxRIGHT, 25
    );

    bSizer1->AddSpacer(7);
    bSizer1->Add( m_headingSizer, 0, wxEXPAND | wxALL, 5 );
    bSizer1->AddSpacer(7);

    m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
    m_scrolledWindow->SetScrollRate( 5, 5 );

    m_checkboxSizer = new wxGridSizer(2, wxSize(0,3));
    CreateCheckboxes();
    
    bSizer1->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 );
    
    wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );

    wxButton* btnOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
    btnOK->SetToolTip( _("Save all values and close the dialog") );
    buttonSizer->Add( btnOK, 0, wxALL, 5 );

    wxButton* btnDefaults = new wxButton( this, ID_DEFAULTSBTN, _("Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
    btnDefaults->SetToolTip( _("Restore default settings") );
    buttonSizer->Add( btnDefaults, 0, wxALL, 5 );

    wxButton* btnCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    btnCancel->SetToolTip( _("Close the dialog without saving") );
    buttonSizer->Add( btnCancel, 0, wxALL, 5 );

    btnCancel->SetDefault();
    bSizer1->Add( buttonSizer, 0, wxALIGN_RIGHT | wxALL, 15 );
    
    SetSizer( bSizer1 );
    
    RestoreState();
    Layout();
    Center( wxBOTH );
    
#if defined(__WXMSW__) || defined(__WXGTK__)
    SetDoubleBuffered(true);
#endif
}
Exemplo n.º 17
0
/* Constructor */
CDlgHiddenColumns::CDlgHiddenColumns(wxWindow* parent) :
    wxDialog( parent, ID_ANYDIALOG, wxEmptyString, wxDefaultPosition,
                wxSize( DLGDIAGNOSTICS_INITIAL_WIDTH,DLGDIAGNOSTICS_INITIAL_HEIGHT ),
                wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
            ) {

    CSkinAdvanced*     pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
    wxASSERT(pSkinAdvanced);
    wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));

    wxString title;
    title.Printf(
        _("%s Column Selection"),
        pSkinAdvanced->GetApplicationShortName().c_str()
    );

    SetTitle(title);
    
    SetSizeHints(DLGDIAGNOSTICS_MIN_WIDTH, DLGDIAGNOSTICS_MIN_HEIGHT);
    SetExtraStyle( GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY );
    
    wxBoxSizer* bSizer1 = new wxBoxSizer( wxVERTICAL );
    m_headingSizer = new wxGridSizer( 1 );
    
    m_headingText.Printf(
        _("Select which columns %s should show."),
        pSkinAdvanced->GetApplicationShortName().c_str()
    );
    
    m_heading = new wxStaticText(this, wxID_ANY, m_headingText);

    m_headingSizer->Add(m_heading, 1, wxLEFT | wxRIGHT, 25);

    bSizer1->AddSpacer(7);
    bSizer1->Add( m_headingSizer, 0, wxEXPAND | wxALL, 5 );
    bSizer1->AddSpacer(7);

    m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
    m_scrolledWindow->SetScrollRate( 5, 5 );

    m_scrolledSizer = new wxBoxSizer(wxVERTICAL);
    
    CreateCheckboxes();
    
    bSizer1->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 );
    
    wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );

    m_btnOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
    m_btnOK->SetToolTip( _("Save all values and close the dialog") );
    buttonSizer->Add( m_btnOK, 0, wxALL, 5 );

    wxButton* btnDefaults = new wxButton( this, ID_DEFAULTSBTN, _("Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
    btnDefaults->SetToolTip( _("Restore default settings") );
    buttonSizer->Add( btnDefaults, 0, wxALL, 5 );

    wxButton* btnCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
    btnCancel->SetToolTip( _("Close the dialog without saving") );
    buttonSizer->Add( btnCancel, 0, wxALL, 5 );

    btnCancel->SetDefault();
    bSizer1->Add( buttonSizer, 0, wxALIGN_RIGHT | wxALL, 15 );
    
    SetSizer( bSizer1 );
    
    RestoreState();
    Layout();
    Center( wxBOTH );
    
#if defined(__WXMSW__) || defined(__WXGTK__)
    SetDoubleBuffered(true);
#endif
}
Exemplo n.º 18
0
CreatePatchFrame::CreatePatchFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	
	wxGridBagSizer* gridBagSizer;
	gridBagSizer = new wxGridBagSizer( 0, 0 );
	gridBagSizer->SetFlexibleDirection( wxBOTH );
	gridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	gridBagSizer->SetMinSize( wxSize( 500,-1 ) ); 
	m_txtOldLabel = new wxStaticText( this, wxID_ANY, wxT("Old version directory:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtOldLabel->Wrap( -1 );
	gridBagSizer->Add( m_txtOldLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtOldDirectory = new wxStaticText( this, wxID_ANY, wxT("-undefined-"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtOldDirectory->Wrap( -1 );
	gridBagSizer->Add( m_txtOldDirectory, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtNewLabel = new wxStaticText( this, wxID_ANY, wxT("New version directory:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtNewLabel->Wrap( -1 );
	gridBagSizer->Add( m_txtNewLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtNewDirectory = new wxStaticText( this, wxID_ANY, wxT("-undefined-"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtNewDirectory->Wrap( -1 );
	gridBagSizer->Add( m_txtNewDirectory, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtPatchLabel = new wxStaticText( this, wxID_ANY, wxT("Output Patch File:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtPatchLabel->Wrap( -1 );
	gridBagSizer->Add( m_txtPatchLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtPatchFile = new wxStaticText( this, wxID_ANY, wxT("-undefined-"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtPatchFile->Wrap( -1 );
	gridBagSizer->Add( m_txtPatchFile, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	gridBagSizer->Add( m_staticline1, wxGBPosition( 3, 0 ), wxGBSpan( 1, 2 ), wxEXPAND | wxALL, 5 );
	
	m_progressComparison = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
	m_progressComparison->SetValue( 0 ); 
	m_progressComparison->SetMinSize( wxSize( 500,25 ) );
	
	gridBagSizer->Add( m_progressComparison, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 5 );
	
	m_txtComparisonLabel = new wxStaticText( this, wxID_ANY, wxT("Files Compared:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtComparisonLabel->Wrap( -1 );
	gridBagSizer->Add( m_txtComparisonLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	m_txtComparison = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxNO_BORDER );
	m_txtComparison->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );

	gridBagSizer->Add( m_txtComparison, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
	
	m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	gridBagSizer->Add( m_staticline2, wxGBPosition( 6, 0 ), wxGBSpan( 1, 2 ), wxEXPAND | wxALL, 5 );
	
	m_txtFiles = new wxStaticText( this, wxID_ANY, wxT("Files Processed:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtFiles->Wrap( -1 );
	gridBagSizer->Add( m_txtFiles, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtPatchProcessed = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxNO_BORDER );
	m_txtPatchProcessed->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );

	gridBagSizer->Add( m_txtPatchProcessed, wxGBPosition( 7, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
	
	m_progressPatchProcessed = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
	m_progressPatchProcessed->SetValue( 0 ); 
	m_progressPatchProcessed->SetMinSize( wxSize( 500,25 ) );
	
	gridBagSizer->Add( m_progressPatchProcessed, wxGBPosition( 8, 0 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 5 );
	
	m_txtProcessing = new wxStaticText( this, wxID_ANY, wxT("Processing File:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_txtProcessing->Wrap( -1 );
	gridBagSizer->Add( m_txtProcessing, wxGBPosition( 9, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
	
	m_txtProcessingFile = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxNO_BORDER );
	m_txtProcessingFile->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	gridBagSizer->Add( m_txtProcessingFile, wxGBPosition( 9, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
	
	m_progressFileProccess = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
	m_progressFileProccess->SetValue( 0 ); 
	m_progressFileProccess->SetMinSize( wxSize( 500,25 ) );
	
	gridBagSizer->Add( m_progressFileProccess, wxGBPosition( 10, 0 ), wxGBSpan( 1, 2 ), wxALL|wxEXPAND, 5 );

	gridBagSizer->AddGrowableCol( 1 );
	
	this->SetSizer( gridBagSizer );
	this->Layout();
	this->Centre( wxBOTH );

	Bind(wxEVT_COMMAND_UPDATE_COMPARISON_PROGRESSBAR, &CreatePatchFrame::OnComparisonProgressUpdate, this);
	Bind(wxEVT_COMMAND_UPDATE_COMPARISON_TEXT, &CreatePatchFrame::OnComparisonTextUpdate, this);

	Bind(wxEVT_COMMAND_UPDATE_PATCH_PROCCESS_PROGRESSBAR, &CreatePatchFrame::OnPatchProcessedProgressUpdate, this);
	Bind(wxEVT_COMMAND_UPDATE_PATCH_PROCCESS_COMPARISON_TEXT, &CreatePatchFrame::OnPatchProcessedTextUpdate, this);

	Bind(wxEVT_COMMAND_UPDATE_FILE_PROCCESS_PROGRESSBAR, &CreatePatchFrame::OnFileProcessedProgressUpdate, this);
	Bind(wxEVT_COMMAND_UPDATE_FILE_PROCCESS_TEXT, &CreatePatchFrame::OnFileProcessedTextUpdate, this);

	Bind(wxEVT_CLOSE_WINDOW, &CreatePatchFrame::OnClose, this);

#ifndef __APPLE__
	SetDoubleBuffered(true);
#endif
}
Exemplo n.º 19
0
bool wxComboCtrl::Create(wxWindow *parent,
                            wxWindowID id,
                            const wxString& value,
                            const wxPoint& pos,
                            const wxSize& size,
                            long style,
                            const wxValidator& validator,
                            const wxString& name)
{

    // Set border
    long border = style & wxBORDER_MASK;

    if ( !border )
    {
        if ( wxUxThemeIsActive() )
        {
            // For XP, have 1-width custom border, for older version use sunken
            border = wxBORDER_NONE;
            m_widthCustomBorder = 1;
        }
        else
            border = wxBORDER_SUNKEN;

        style = (style & ~(wxBORDER_MASK)) | border;
    }

    // create main window
    if ( !wxComboCtrlBase::Create(parent,
                           id,
                           value,
                           pos,
                           size,
                           style | wxFULL_REPAINT_ON_RESIZE,
                           validator,
                           name) )
        return false;

    if ( wxUxThemeIsActive() && ::wxGetWinVersion() >= wxWinVersion_Vista )
            m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;

    if ( style & wxCC_STD_BUTTON )
        m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;

    // Prepare background for double-buffering or better background theme
    // support, whichever is possible.
    SetDoubleBuffered(true);
    if ( !IsDoubleBuffered() )
        SetBackgroundStyle( wxBG_STYLE_PAINT );

    // Create textctrl, if necessary
    CreateTextCtrl( wxNO_BORDER );

    // Add keyboard input handlers for main control and textctrl
    InstallInputHandlers();

    // SetInitialSize should be called last
    SetInitialSize(size);

    return true;
}
Exemplo n.º 20
0
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) :
    wxWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxBORDER_NONE),
    cpu(_cpu),
    lastPc(0),
    lastCycles(0),
    maxBits(128),
    needsSizeUpdating(true),
    needsValueUpdating(true)
{
    int rowHeight = g_Conf->EmuOptions.Debugger.FontHeight;
    int charWidth = g_Conf->EmuOptions.Debugger.FontWidth;


#ifdef _WIN32
    wxFont font = wxFont(wxSize(charWidth, rowHeight), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
        false, L"Lucida Console");
    wxFont labelFont = font.Bold();
#else
    wxFont font = wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Lucida Console");
    font.SetPixelSize(wxSize(charWidth, rowHeight));
    wxFont labelFont = font;
    labelFont.SetWeight(wxFONTWEIGHT_BOLD);
#endif
    registerCategories = new wxNotebook(this, wxID_ANY);
// 'c' and 'C', much time wasted.
#if wxMAJOR_VERSION >= 3
    registerCategories->Connect(wxEVT_BOOKCTRL_PAGE_CHANGED, wxBookCtrlEventHandler(CtrlRegisterList::categoryChangedEvent), nullptr, this);
#else
    registerCategories->Connect(wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED, wxBookctrlEventHandler(CtrlRegisterList::categoryChangedEvent), nullptr, this);
#endif
    for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++)
    {
        int numRegs = cpu->getRegisterCount(cat);

        changedCategories.push_back(std::vector<ChangedReg>(numRegs));

        wxGrid* regGrid = new wxGrid(registerCategories, -1);

        registerGrids.push_back(regGrid);
        registerCategories->AddPage(regGrid, wxString(cpu->getRegisterCategoryName(cat), wxConvUTF8));

        DebugInterface::RegisterType type = cpu->getRegisterType(cat);
        int registerBits = cpu->getRegisterSize(cat);

        int numCols;
        switch (type)
        {
        case DebugInterface::NORMAL:	// display them in 32 bit parts
            numCols = registerBits / 32;
            regGrid->CreateGrid(numRegs, numCols);
            for (int row = 0; row < numRegs; row++)
                regGrid->SetRowLabelValue(row, wxString(cpu->getRegisterName(cat, row), wxConvUTF8));
            for (int col = 0; col < numCols; col++)
                regGrid->SetColLabelValue(col, wxsFormat(L"%d-%d", 32 * (numCols - col) - 1, 32 * (numCols - col - 1)));
            break;
        case DebugInterface::SPECIAL:
            regGrid->CreateGrid(numRegs, 1);
            for (int row = 0; row < numRegs; row++)
                regGrid->SetRowLabelValue(row, wxString(cpu->getRegisterName(cat, row), wxConvUTF8));
            break;
        }

        regGrid->EnableEditing(false);
        regGrid->SetDefaultCellFont(font);
        regGrid->SetLabelFont(labelFont);
        regGrid->DisableDragGridSize();
        regGrid->DisableDragRowSize();
        regGrid->DisableDragColSize();
        regGrid->Connect(wxEVT_PAINT, wxPaintEventHandler(CtrlRegisterList::paintEvent), nullptr, this);
        regGrid->Connect(wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
        regGrid->Connect(wxEVT_GRID_LABEL_RIGHT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
        regGrid->Connect(wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
        regGrid->Connect(wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler(CtrlRegisterList::gridEvent), nullptr, this);
        regGrid->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(CtrlRegisterList::keydownEvent), nullptr, this);
    }

    for (int cat = 0; cat < cpu->getRegisterCategoryCount(); cat++)
        updateValues(cat);

    updateSize(getCurrentCategory()); // getCurrentCategory() = 0

    SetDoubleBuffered(true);
}