TextEditorStc::TextEditorStc(wxWindow *parent, ProjectItem *p)
  : wxWindow(parent, wxWindowID(ID_EDIT_WND), wxDefaultPosition, wxDefaultSize)
{
	sciFlags = 0;
	findFlags = 0;
	pi = p;
	edwnd = new wxStyledTextCtrl(this, wxWindowID(ID_EDIT_CTL), wxPoint(0,0), wxDefaultSize, wxVSCROLL|wxHSCROLL|wxBORDER_SIMPLE);

	wxString face(prjOptions.editFontFace);
	edwnd->SetCodePage(wxSTC_CP_UTF8);
//	edwnd->StyleSetForeground(STYLE_DEFAULT, wxColour(prjOptions.editTextColor));
	edwnd->StyleSetSize(wxSTC_STYLE_DEFAULT, prjOptions.editFontSize);
	edwnd->StyleSetFaceName(wxSTC_STYLE_DEFAULT, face);
	edwnd->SetTabWidth(prjOptions.editTabSize);
	edwnd->SetIndent(prjOptions.editTabSize);
	edwnd->SetUseTabs(true);
	edwnd->MarkerDefine(0, wxSTC_MARK_ROUNDRECT, wxColour(0,0,200), wxColour(0,0,160));
	if (pi && pi->GetType() == PRJNODE_NOTEFILE)
	{
		edwnd->SetLexer(wxSTC_LEX_CONTAINER);
		edwnd->StyleClearAll();
		edwnd->StyleSetForeground(NLSTYLE_DEFAULT, wxColour(prjOptions.editTextColor));
		edwnd->StyleSetForeground(NLSTYLE_KEYWORD, wxColour(0,0,0x80));
		edwnd->StyleSetBold(NLSTYLE_KEYWORD, true);
		edwnd->StyleSetForeground(NLSTYLE_QUOTE, wxColour(0x60,0x20,0));
		edwnd->StyleSetForeground(NLSTYLE_DELIM, wxColour(0x40,0,0));
		//edwnd->StyleSetBold(NLSTYLE_DELIM, true);
		edwnd->StyleSetForeground(NLSTYLE_COMMENT, wxColour(0,0x80,0));
		for (int n = NLSTYLE_DEFAULT; n <= NLSTYLE_COMMENT; n++)
			edwnd->StyleSetFaceName(n, face);
	}
	else
		edwnd->SetLexer(wxSTC_LEX_NULL);
	edwnd->SetMarginType(0, wxSTC_MARGIN_NUMBER);
}
TextEditorWX::TextEditorWX(wxWindow *parent, ProjectItem *p)
  : wxWindow(parent, wxWindowID(ID_EDIT_WND), wxDefaultPosition, wxDefaultSize)
{
	pi = p;
	edwnd = new wxTextCtrl(this, wxWindowID(ID_EDIT_CTL), "", wxPoint(0,0), wxDefaultSize,
		wxVSCROLL|wxHSCROLL|wxBORDER_SIMPLE|wxTE_MULTILINE|wxTE_RICH2|wxTE_NOHIDESEL|wxTE_PROCESS_TAB);
	wxFont font(12, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, prjOptions.editFontFace);
	edwnd->SetFont(font);
}
Beispiel #3
0
/// This is a convenience function that allows for button creation in
/// MakeButtons() with fewer arguments
/// Very similar to code in ControlToolBar...
AButton *EditToolBar::AddButton(
   EditToolBar *pBar,
   teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
   int id,
   const wxChar *label,
   bool toggle)
{
   AButton *&r = pBar->mButtons[id];

   r = ToolBar::MakeButton(pBar,
      bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredUpHiliteSmall, bmpRecoloredHiliteSmall,
      eEnabledUp, eEnabledDown, eDisabled,
      wxWindowID(id+first_ETB_ID),
      wxDefaultPosition,
      toggle,
      theTheme.ImageSize( bmpRecoloredUpSmall ));

   r->SetLabel(label);
// JKC: Unlike ControlToolBar, does not have a focus rect.  Shouldn't it?
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );

   pBar->Add( r, 0, wxALIGN_CENTER );

   return r;
}
Beispiel #4
0
void EditToolBar::AddButton(const char **fg, const char **disabled, const char **alpha,
                            int id, const char *tooltip)
{

   // Windows (TM) has a little extra room for some reason, so the top of the
   // buttons should be a little lower.
   int buttonTop = 0;
#ifdef __WXMSW__
   buttonTop=0;
#endif

   mButtons[id] = ToolBar::MakeButton(
                     upImage, downImage, hiliteImage, fg,
                     disabled, alpha,
                     wxWindowID(id), wxPoint(mButtonPos, buttonTop),
                     false /*No edit buttons should process down events.*/,
                     wxSize(BUTTON_WIDTH, BUTTON_WIDTH), 0, 0);

   #if wxUSE_TOOLTIPS // Not available in wxX11
   mButtons[id]->SetToolTip(tooltip);
   #endif

   mButtonPos += BUTTON_WIDTH;
   mDividers[mNumDividers++] = mButtonPos++;
}
Beispiel #5
0
// This is a convenience function that allows for button creation in
// MakeButtons() with fewer arguments
AButton *ControlToolBar::MakeButton(char const **foreground,
                                    char const **disabled,
                                    char const **alpha, int id, bool processdownevents)
{

   // Windows (TM) has a little extra room for some reason, so the top of the
   // buttons should be a little lower.
   int buttonTop = 4;
#ifdef __WXMSW__
   buttonTop=4;
#endif


   AButton *r = ToolBar::MakeButton(upPattern, downPattern, hilitePattern,
                                    foreground, disabled, alpha, wxWindowID(id),
                                    wxPoint(mButtonPos,buttonTop), processdownevents,
                                    wxSize(48, 48), 16, 16);
   mButtonPos += BUTTON_WIDTH;
   #if (AUDACITY_BRANDING == BRAND_AUDIOTOUCH)
      // We're overlaying ID_PAUSE_BUTTON on top of ID_PLAY_BUTTON, so don't bump x coordinate after PLAY.
      if (id == ID_PLAY_BUTTON) 
         mButtonPos -= BUTTON_WIDTH;
      else if (id == ID_PAUSE_BUTTON)
      {
         r->Hide(); // Default is to show Play, not Pause.
         this->EnablePauseCommand(false);
      }
   #endif
   return r;
}
Beispiel #6
0
AButton * ToolsToolBar::MakeTool( teBmps eTool,
   int id, const wxChar *label)
{
   AButton *button = ToolBar::MakeButton(this,
      bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
      eTool, eTool, eTool,
      wxWindowID(id),
      wxDefaultPosition, true,
      theTheme.ImageSize( bmpRecoloredUpSmall ));
   button->SetLabel( label );
   mToolSizer->Add( button );
   return button;
}
Beispiel #7
0
// This is a convenience function that allows for button creation in
// MakeButtons() with fewer arguments
AButton *ControlToolBar::MakeButton(teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
                                    int id,
                                    bool processdownevents,
                                    const wxChar *label)
{
   AButton *r = ToolBar::MakeButton(
      bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredHiliteLarge,
      eEnabledUp, eEnabledDown, eDisabled,
      wxWindowID(id),
      wxDefaultPosition, processdownevents,
      theTheme.ImageSize( bmpRecoloredUpLarge ));
   r->SetLabel(label);
   r->SetFocusRect( r->GetRect().Deflate( 12, 12 ) );

   return r;
}
/// This is a convenience function that allows for button creation in
/// MakeButtons() with fewer arguments
/// Very similar to code in ControlToolBar...
AButton *TranscriptionToolBar::AddButton(
   teBmps eFore, teBmps eDisabled,
   int id,
   const wxChar *label)
{
   AButton *&r = mButtons[id];

   r = ToolBar::MakeButton(
      bmpRecoloredUpSmall, bmpRecoloredDownSmall, bmpRecoloredHiliteSmall,
      eFore, eFore, eDisabled,
      wxWindowID(id),
      wxDefaultPosition,
      false,
      theTheme.ImageSize( bmpRecoloredUpSmall ));

   r->SetLabel(label);
// JKC: Unlike ControlToolBar, does not have a focus rect.  Shouldn't it?
// r->SetFocusRect( r->GetRect().Deflate( 4, 4 ) );

   Add( r, 0, wxALIGN_CENTER );

   return r;
}
Beispiel #9
0
	// Dialog constructor
	WxDlg::WxDlg(const Properties &properties,
			const Result &assertionResult,
			const InfoProviders::InfoUser &infoUser):

	wxDialog((wxWindow*) NULL, wxWindowID(5),
			"",
			wxDefaultPosition),
		m_properties(properties),
		m_assertionResult(assertionResult),
		m_infoUser(infoUser),
		m_debug(0), m_exit(0), m_optional(0), m_globalOptional(0),
		m_stopDisplayingThis(0), m_stopDisplayingThisFile(0),
		m_stopDisplayingAll(0),
		m_stopDisplayingCustom1(0), m_stopDisplayingCustom2(0),
		m_stopDisplayingCustom3(0), m_stopDisplayingCustom4(0)
	{
		wxString title = m_properties.GetCategory()->GetName();
		title += m_assertionResult.Succeeded() ? " succeeded" : " failed";
		title[0] = toupper(title[0]);
		SetTitle(title);

		wxBoxSizer *mainSizer = new wxBoxSizer( wxVERTICAL );
		
		mainSizer->AddSpacer(10); // empty space at the top

		wxString message;
		if (!m_properties.IsUnconditional())
		{
			message << properties.GetCategory()->GetName();
			if (m_properties.GetCondition())
				message << " " << m_properties.GetCondition();
			message << (m_assertionResult.Succeeded() ?  " succeeded" : " failed");
			if (!m_properties.GetCondition())
				message << " (no text of condition available)";
		}
		else
			message << "Unconditional " << properties.GetCategory()->GetName()
				<< " failure";
		int x=0, y=0;
		GetTextExtent(message, &x, &y);
		int nrLines = x/375+1;
		wxTextCtrl *msgWnd = new wxTextCtrl(this, -1, message,
			wxDefaultPosition, wxSize(400, y*nrLines+y/2),
			wxTE_MULTILINE|wxTE_READONLY);
		mainSizer->Add(msgWnd);

		mainSizer->AddSpacer(5);

		message = RichBool::ToString(m_properties.GetContext());
		mainSizer->Add(new wxStaticText(this, -1, message));

		const int fontSize = GetFont().GetPointSize();

		if (m_assertionResult.GetAnalysis())
		{
			wxTextCtrl *textCtrl = new wxTextCtrl(this, -1,
				RichBool::ToString(*m_assertionResult.GetAnalysis()),
				wxDefaultPosition, wxSize(400, 80), wxTE_MULTILINE|wxTE_READONLY);

			wxFont font(fontSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL);
			textCtrl->SetFont(font);

			mainSizer->AddSpacer(10);
			mainSizer->Add(textCtrl);
		}

		if (m_assertionResult.GetParameterList() && m_assertionResult.GetParameterList()->GetFirst())
		{
			wxListCtrl *listCtrl = new wxListCtrl(this, -1, wxDefaultPosition,
				wxSize(400, 80), wxLC_REPORT);

			listCtrl->InsertColumn(0, "Expressions", wxLIST_FORMAT_LEFT, 160);
			listCtrl->InsertColumn(1, "Values",      wxLIST_FORMAT_LEFT, 230);

			int idx = 0;
			for (const ParameterList::Message *msg=m_assertionResult.GetParameterList()->GetFirst();
				msg; msg = msg->GetNext(), ++idx)
			{
				wxString message = msg->GetMessage();
				if (msg->GetType()==ParameterList::eMessage)
				{
					listCtrl->InsertItem(idx, "message");
					listCtrl->SetItem(idx, 1, message);
				}
				else if (msg->GetType()==ParameterList::eValue)
				{
					ParameterList::Value *value =
						(ParameterList::Value*)msg;
					wxString str = "expr: ";
					listCtrl->InsertItem(idx, str+message);
					listCtrl->SetItem(idx, 1,
						value->GetValue());
				}
			}

			mainSizer->AddSpacer(10);
			mainSizer->Add(listCtrl);
		}

		wxString extraInfo = GetAllInfo(m_properties, m_assertionResult, m_infoUser);
		if (!extraInfo.IsEmpty())
		{
			wxTextCtrl *textCtrl = new wxTextCtrl(this, -1, extraInfo,
				wxDefaultPosition, wxSize(400, 6*fontSize), wxTE_MULTILINE|wxTE_READONLY);

			wxFont font(fontSize, wxFONTFAMILY_MODERN, wxNORMAL, wxNORMAL);
			textCtrl->SetFont(font);

			mainSizer->AddSpacer(10);
			mainSizer->Add(textCtrl);
		}

		wxBoxSizer *leftInputsSizer  = new wxBoxSizer( wxVERTICAL );

		wxBoxSizer *debugExitSizer  = new wxBoxSizer( wxHORIZONTAL );
		m_debug = new wxCheckBox(this, -1, _("Debug"));

		if (!GetAllowBreakIntoDebugger())
			m_debug->Disable();
	#if defined(__WIN32__) || (defined(__WXMAC__) && defined(__MWERKS__))
		if (!wxIsDebuggerRunning() || !IsDebugPossible())
			m_debug->Disable();
	#endif

		m_exit = new wxCheckBox(this, -1, _("Exit"));
		if (!GetAllowExit())
			m_exit->Disable();

		debugExitSizer->Add(m_debug);
		debugExitSizer->AddSpacer(15);
		debugExitSizer->Add(m_exit);

		leftInputsSizer->Add(debugExitSizer);
		leftInputsSizer->AddSpacer(8);
		
		if (GetGlobalOptionalAction() && GetAllowGlobalOptional())
		{
			m_globalOptional = new wxCheckBox(this, -1, GetGlobalOptionalActionDescription());
			leftInputsSizer->AddSpacer(8);
			leftInputsSizer->Add(m_globalOptional);
		}

		if (m_properties.GetOptional() && GetAllowOptional())
		{
			m_optional = new wxCheckBox(this, -1, m_properties.GetOptional());
			leftInputsSizer->AddSpacer(8);
			leftInputsSizer->Add(m_optional);
		}

		if (GetOptionalLogger())
		{
			leftInputsSizer->AddSpacer(8);
			leftInputsSizer->Add(
				new wxButton(this, OptionalLogger, GetOptionalLoggerText(),
					wxDefaultPosition, wxDefaultSize)
			);
		}

		leftInputsSizer->AddSpacer(8);
		leftInputsSizer->Add(
			new wxButton(this, Ok, _("Ok"), wxDefaultPosition, wxDefaultSize)
		);
		
		wxBoxSizer *stopDisplayingLeftSizer = new wxBoxSizer(wxVERTICAL),
			*stopDisplayingRightSizer = new wxBoxSizer(wxVERTICAL);

		const int spacing = 5;
		if (properties.CanStopDisplayingThis())
		{
			m_stopDisplayingThis = new wxCheckBox(this, -1, "This");
			stopDisplayingLeftSizer->Add(m_stopDisplayingThis);
			stopDisplayingLeftSizer->AddSpacer(spacing);
		}
		m_stopDisplayingThisFile = new wxCheckBox(this, -1, "In this file");
		m_stopDisplayingAll = new wxCheckBox(this, -1,
			wxString("All ")+m_properties.GetCategory()->GetName()+"s");
		stopDisplayingLeftSizer->Add(m_stopDisplayingThisFile);
		stopDisplayingLeftSizer->AddSpacer(spacing);
		stopDisplayingLeftSizer->Add(m_stopDisplayingAll);

		const GroupList *groupList = m_properties.GetGroupList();
		m_stopDisplayingCustom1 =
			new wxCheckBox(this, -1, groupList->GetSize()>0 ? groupList->GetName(0) : "-");
		m_stopDisplayingCustom1->Enable(groupList->GetSize()>0);
		
		m_stopDisplayingCustom2 =
			new wxCheckBox(this, -1, groupList->GetSize()>1 ? groupList->GetName(1) : "-");
		m_stopDisplayingCustom2->Enable(groupList->GetSize()>1);
		
		m_stopDisplayingCustom3 =
			new wxCheckBox(this, -1, groupList->GetSize()>2 ? groupList->GetName(2) : "-");
		m_stopDisplayingCustom3->Enable(groupList->GetSize()>2);
		
		m_stopDisplayingCustom4 =
			new wxCheckBox(this, -1, groupList->GetSize()>3 ? groupList->GetName(3) : "-");
		m_stopDisplayingCustom4->Enable(groupList->GetSize()>3);

		stopDisplayingRightSizer->Add(m_stopDisplayingCustom1);
		stopDisplayingRightSizer->AddSpacer(spacing);
		stopDisplayingRightSizer->Add(m_stopDisplayingCustom2);
		stopDisplayingRightSizer->AddSpacer(spacing);
		stopDisplayingRightSizer->Add(m_stopDisplayingCustom3);
		stopDisplayingRightSizer->AddSpacer(spacing);
		stopDisplayingRightSizer->Add(m_stopDisplayingCustom4);

		wxString stopDisplayingTitle = "Stop displaying ";
		stopDisplayingTitle += m_properties.GetCategory()->GetName();
		stopDisplayingTitle += "s";
		wxStaticBoxSizer *stopDisplayingSizer =
			new wxStaticBoxSizer(wxHORIZONTAL, this, stopDisplayingTitle);

		stopDisplayingSizer->Add(stopDisplayingLeftSizer);
		stopDisplayingSizer->AddSpacer(6);
		stopDisplayingSizer->Add(stopDisplayingRightSizer);

		wxBoxSizer *inputsSizer = new wxBoxSizer( wxHORIZONTAL );
		inputsSizer->Add(leftInputsSizer);
		inputsSizer->AddSpacer(50);
		inputsSizer->Add(stopDisplayingSizer);

		mainSizer->AddSpacer(10);
		mainSizer->Add(inputsSizer);

		mainSizer->AddSpacer(10); // empty space at the bottom

		wxBoxSizer *wrapperSizer = new wxBoxSizer(wxHORIZONTAL);
		wrapperSizer->AddSpacer(10);
		wrapperSizer->Add(mainSizer);
		wrapperSizer->AddSpacer(10);

		SetSizerAndFit(wrapperSizer);

		// set the Dialog icon
		if (m_assertionResult.Succeeded())
			SetIcon(ModAssertS_xpm);
		else
			SetIcon(ModAssertF_xpm);

		Fit();
	}
GenerateDlg::GenerateDlg(wxWindow *parent, int a, int pl)
{
	genAuto = a;
	lastTime = 0;
	canceled = 0;
	paused = 0;
	if (pl >= 0)
		playLive = pl;
	dlgLock.Create();

	wxXmlResource::Get()->LoadDialog(this, parent, "DLG_GENERATE");
	CenterOnParent();
	EnableOK(1, 0);

	wxSize sz;
	wxPoint pt;

	ed = (wxTextCtrl*)FindWindow("IDC_TEXT");
	tm = (wxTextCtrl*)FindWindow("IDC_TIME");
	tm->ChangeValue("00:00.0");
	sz = tm->GetSize();
	pt = tm->GetPosition();
	pt.x += sz.GetWidth() + 2;
	wxWindow *btn = FindWindow(wxID_OK);
	sz.SetWidth(btn->GetPosition().x + btn->GetSize().GetWidth() - pt.x);
	tml = new BarMeter(this, wxWindowID(102), pt, sz);

	lpk = (wxTextCtrl*)FindWindow("IDC_LEFT_PEAK");
	rpk = (wxTextCtrl*)FindWindow("IDC_RIGHT_PEAK");

	sz = lpk->GetSize();
	pt = lpk->GetPosition();
	pt.x += sz.GetWidth() + 2;
	sz.SetWidth(sz.GetWidth() * 2);
	lpkMtr = new BarMeter(this, wxWindowID(100), pt, sz);
	lpkMtr->SetRange(1.2);
	lpkMtr->Show();

	sz = rpk->GetSize();
	pt = rpk->GetPosition();
	pt.x += sz.GetWidth() + 2;
	sz.SetWidth(sz.GetWidth() * 2);
	rpkMtr = new BarMeter(this, wxWindowID(100), pt, sz);
	rpkMtr->SetRange(1.2);
	rpkMtr->Show();

	rateWnd = (wxComboBox*)FindWindow("IDC_RATE");
	rateWnd->Append("0.1 Sec", (void*)1);
	rateWnd->Append("0.5 Sec", (void*)5);
	rateWnd->Append("1.0 Sec", (void*)10);
	rateWnd->Append("5.0 Sec", (void*)50);
	rateWnd->Select(0);

	SetPlayOutput();
	SetPlayRange();

	FormatTime("IDC_PLAY_FROM", playFrom);
	FormatTime("IDC_PLAY_TO", playTo);

	wxCheckBox *on;
	on = (wxCheckBox*)FindWindow("IDC_PEAK_ON");
	on->SetValue(pkOn);
	on = (wxCheckBox*)FindWindow("IDC_TIME_ON");
	on->SetValue(tmOn);

	if (genAuto)
	{
		wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, XRCID("IDC_START"));
		evt.SetEventObject(this);
		wxPostEvent(this, evt);
	}
}