예제 #1
0
wxToolBar* EvtGroup::CreateTbar(wxWindow* pw,int wd)
{

	PrepareItems();

	HeTbarImpl* tb=new HeTbarImpl(this,pw,wd);

	for(size_t i=0;i<size();i++)
	{
		EvtCommand* pCommand=(*this)[i].get();
		if(pCommand->flags.get(EvtBase::FLAG_HIDE_UI)) continue;
		if(pCommand->flags.get(EvtBase::FLAG_SEPARATOR)) {tb->AddSeparator();continue;}

		pCommand->CreateToolItem(tb);
	}

	tb->Realize();

	if(flags.get(FLAG_HIDE_UI)) tb->Show(false);
	if(flags.get(FLAG_DISABLE)) tb->Enable(false);

	flags.set(FLAG_CHECKED,!flags.get(FLAG_HIDE_UI));

	tb->SetName(str2wx(m_sId));

	return tb;

}
예제 #2
0
	EvtCommandWindowMessage():EvtCommandWindow(_kT("Message")),wm(WndManager::current())
	{
		memset(m_aLogLevelEnabled,-1,sizeof(m_aLogLevelEnabled));
		memset(m_nLogLevelCount,0,sizeof(m_nLogLevelCount));

		m_nMaxSize=4000;
		m_nCapacity=5000;
		m_nRdPos=0;
		m_nWrPos=0;

		m_aRecords.resize(m_nCapacity);

		EvtManager::current().append(new EvtCommandMessageAdded(*this));

        m_pListModel = new IMessageModel(*this);
		m_pListView = new IMessageView(*this,WndModel::current().GetWindow());

		//m_pListView->Connect(wxID_ANY,wxEVT_CHILD_FOCUS,wxChildFocusEventHandler(MyWindow::OnFocus));


		m_pListView->SetName(str2wx(m_sId));
        m_pListView->AssociateModel( m_pListModel.get() );

		m_pListView->SetSize(wxSize(480,240));
		m_pListView->SetMinSize(wxSize(120,120));

		SetWindow(m_pListView);

		LogTarget* ptarget=new LogTargetMessage(*this);
		WndManager::current().logptr.SetData(ptarget);
		Logger::def(ptarget);

		wm.evtmgr["CloseFrame"].AttachListener(this);

	}
예제 #3
0
void WndUpdator::tb_add(const String& s,int f)
{
	EvtGroup* pg=wm.evtmgr.get_group(s);
	if(!pg) return;

	pg->flags.add(f);
	wxToolBar* tb=pg->CreateTbar(wm.model.GetWindow());
	if(!tb) return;
	

	pg->flags.del(EvtCommand::FLAG_DOTDOT);
	pg->flags.add(EvtCommand::FLAG_CHECK);
	pg->flags.set(EvtCommand::FLAG_CHECKED,tb->IsShown());

	tb->SetName(str2wx(s));

	pg->SetWindow(tb);


	EvtManager &ec(wm.evtmgr);
	ec.gp_beg("ToolBars");
		ec.gp_add(s);
	ec.gp_end();

	pg->UpdateCtrl();

}
예제 #4
0
bool ICtl_ribbon_buttonbar::AddCtrlItem(EvtGroup* pevt)
{
	const BitmapBundle& bundle(pevt->GetBundle(16, 1));
	wxRibbonButtonBarButtonBase* item = m_p_wx_impl->AddButton(pevt->m_nId, str2wx(pevt->MakeLabel()),bundle.bmp_normal,"",   wxRIBBON_BUTTON_DROPDOWN);
	InitToolItem(pevt, item);
	return true;
}
예제 #5
0
bool ICmdProcTextEntryStc::TestSelection()
{
	long p1,p2(0);
	Target.GetSelection(&p1,&p2);
	if(p1==p2)
	{
		return false;
	}

	Target.SetTargetStart(p1);
	Target.SetTargetEnd(Target.GetLastPosition());

	if(Target.SearchInTarget(str2wx(data.text_old))==-1)
	{
		return false;
	}

	if(Target.GetTargetStart()==p1&&Target.GetTargetEnd()==p2)
	{
		Target.GotoPos(p1);
		return true;	
	}

	return false;
}
예제 #6
0
	ICtl_ribbon_sizer(IWindowPtr p, EvtGroup* pevt, int wd) :ICtl_ribbon_panel(pevt)
	{
		Create(p, pevt->m_nId, str2wx(Translate(name)),
			wxNullBitmap, wxDefaultPosition, wxDefaultSize,
			wxRIBBON_PANEL_DEFAULT_STYLE |
			wxRIBBON_PANEL_EXT_BUTTON);

		
	}
예제 #7
0
bool IWnd_stc::DoLoadFile(const wxString& file,int)
{
	StringBuffer<char> buff;
	buff.load(wx2str(file));

	SetText(str2wx(buff));
	EmptyUndoBuffer();
	SetSavePoint();

	return true;
}
예제 #8
0
void IWnd_stc::UpdateStyle(const String& lang)
{
	wxArrayString s=wxSplit(str2wx(lang),'.');
	if(s.size()==0) return;

	wxString ext=wxT("*.")+s.Last().Lower()+wxT(";");
	for(size_t i=0;i<StcManager::current().langs.size();i++)
	{
		StcLangInfo& lf(StcManager::current().langs[i]);
		if(lf.name==lang||str2wx(lf.filepattern).Find(ext)>=0)
		{
			tempp.nlang=i;
			break;
		}
	}

	if(tempp.nlang!=param.nlang)
	{
		UpdateStyle();
	}
}
예제 #9
0
	ICtl_ribbon_toolbar(IWindowPtr p, EvtGroup* pevt,int wd) :ICtl_ribbon_panel(pevt)
	{
		Create(p, pevt->m_nId, str2wx(Translate(name)),
			wxNullBitmap, wxDefaultPosition, wxDefaultSize,
			wxRIBBON_PANEL_NO_AUTO_MINIMISE |
			wxRIBBON_PANEL_EXT_BUTTON);

		wd = 16;
		m_p_wx_impl=new wxRibbonToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
		m_p_wx_impl->SetName(str2wx(m_pGroup->m_sId));

		for (size_t i = 0; i<pevt->size(); i++)
		{
			EvtCommand* pCommand = (*pevt)[i].get();
			if (pCommand->flags.get(EvtBase::FLAG_HIDE_UI)) continue;
			if (pCommand->flags.get(EvtBase::FLAG_SEPARATOR)) { m_p_wx_impl->AddSeparator(); continue; }

			pCommand->CreateCtrlItem(this);
		}

		m_p_wx_impl->SetRows(2, -1);

		bool flag = m_p_wx_impl->Realize();

		if (!flag)
		{
			System::LogMessage("wxToolBar realize failed!");
		}

		if (pevt->flags.get(EvtBase::FLAG_HIDE_UI)) m_p_wx_impl->Show(false);
		if (pevt->flags.get(EvtBase::FLAG_DISABLE)) m_p_wx_impl->Enable(false);

		pevt->flags.set(EvtBase::FLAG_CHECKED, !pevt->flags.get(EvtBase::FLAG_HIDE_UI));

		m_p_wx_impl->SetName(str2wx(pevt->m_sId));

		this->Connect(wxID_ANY, wxEVT_RIBBONTOOLBAR_CLICKED, wxRibbonToolBarEventHandler(ICtl_ribbon_toolbar::OnRibbonToolClick));
		this->Connect(wxID_ANY, wxEVT_RIBBONTOOLBAR_DROPDOWN_CLICKED, wxRibbonToolBarEventHandler(ICtl_ribbon_toolbar::OnRibbonToolDropdown));
	}
예제 #10
0
void MvcBook::UpdateTitle()
{
	MvcView* pView=m_pBook->m_pActiveView;
	if(!pView) return;
	bool f1=pView->Target.TestId(CmdProc::CP_DIRTY);

	int sel=m_pBook->GetSelection();

	String text=pView->GetTitle();
	text+=f1?"*":"";

	m_pBook->SetPageText(sel,str2wx(text));

}
예제 #11
0
	ICtl_ribbon_gallery(IWindowPtr p, EvtGroup* pevt, int wd) :ICtl_ribbon_panel(pevt)
	{
		Create(p, pevt->m_nId, str2wx(Translate(name)),
			wxNullBitmap, wxDefaultPosition, wxDefaultSize,
			wxRIBBON_PANEL_NO_AUTO_MINIMISE |
			wxRIBBON_PANEL_EXT_BUTTON);

		wd = 16;
		m_p_wx_impl = new wxRibbonGallery(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
		m_p_wx_impl->SetName(str2wx(m_pGroup->m_sId));

		for (size_t i = 0; i<pevt->size(); i++)
		{
			EvtCommand* pCommand = (*pevt)[i].get();
			if (pCommand->flags.get(EvtBase::FLAG_HIDE_UI)) continue;
			if (pCommand->flags.get(EvtBase::FLAG_SEPARATOR)) continue; 

			pCommand->CreateCtrlItem(this);
		}

		m_p_wx_impl->SetName(str2wx(pevt->m_sId));
		this->Connect(wxID_ANY, wxEVT_RIBBONGALLERY_SELECTED, wxRibbonGalleryEventHandler(ICtl_ribbon_gallery::OnRibbonGallerySelected));
	}
예제 #12
0
bool ICmdProcTextEntryStc::DoFind(ICmdParam& cmd)
{		
	long p1=Target.GetInsertionPoint();

	Target.SetTargetStart(p1);
	Target.SetTargetEnd(Target.GetLastPosition());

	if(Target.SearchInTarget(str2wx(data.text_old))==-1)
	{

		if(cmd.param2==1) return false;
		
		Target.SetTargetStart(0);
		Target.SetTargetEnd(Target.GetLastPosition());

		if(Target.SearchInTarget(str2wx(data.text_old))!=-1)
		{
			int rt=Wrapper::MsgsDialog(_hT("no more results, restart?"),IDefs::BTN_YES|IDefs::BTN_NO|IDefs::ICON_QUESTION);
			if(rt!=IDefs::BTN_YES)
			{
				return false;
			}
		}
		else
		{
			Wrapper::MsgsDialog(_hT("no more results!"),IDefs::ICON_MESSAGE|IDefs::BTN_OK);
			return false;
		}
	}

	Target.GotoPos(Target.GetTargetStart());
	Target.SetSelection(Target.GetTargetStart(),Target.GetTargetEnd());
	Target.SetInsertionPoint(Target.GetTargetEnd());

	return true;
}
예제 #13
0
bool ICtl_ribbon_buttonbar::AddCtrlItem(EvtCommand* pevt)
{
	if (pevt->flags.get(EvtCommand::FLAG_SEPARATOR))
	{
		return true;
	}

	wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL;
	if (pevt->flags.get(EvtCommand::FLAG_CHECK)) kind = wxRIBBON_BUTTON_TOGGLE;

	const BitmapBundle& bundle(pevt->GetBundle(16, 1));
	wxRibbonButtonBarButtonBase* item = m_p_wx_impl->AddButton(pevt->m_nId,  str2wx(pevt->MakeLabel()),bundle.bmp_normal,"", kind);

	InitToolItem(pevt, item);
	return true;
}
예제 #14
0
bool ICmdProcTextEntryStc::DoReplace(ICmdParam& cmd)
{	
	if(!TestSelection())
	{
		return DoFind(cmd);
	}

	int pos=Target.GetTargetStart();	
	int len=Target.ReplaceTarget(str2wx(data.text_new));

	Target.SetInsertionPoint(pos+len);
	Target.SetSelection(pos+len,pos+len);

	DoFind(cmd);
	return true;
}
예제 #15
0
wxMenu* EvtGroup::CreateMenu(HeMenuImpl* mu,bool prepare)
{
	if(prepare)
	{
		PrepareItems();
	}

	if(!mu)
	{
		mu=new HeMenuImpl(this);
	}
	else
	{
		EvtGroup::ClearMenu(mu);
	}

	int last_is_seperator=-1;
	for(size_t i=0;i<impl.size();i++)
	{
		EvtCommand* vp=(*this)[i].get();
		if(vp->flags.get(EvtBase::FLAG_HIDE_UI)) continue;
		if(vp->flags.get(EvtCommand::FLAG_SEPARATOR))
		{
			if(last_is_seperator==0) last_is_seperator=1;
		}
		else
		{
			if(last_is_seperator==1) mu->AppendSeparator();
			last_is_seperator=0;

			vp->CreateMenuItem(mu);
		}
	}

	if(last_is_seperator==-1)
	{
		EvtCommand* vp=EvtManager::current()["Empty"].cast_command();
		if(vp)
		{
			mu->Append(wxID_ANY,str2wx(vp->MakeLabel()))->Enable(false);
		}
	}

	return mu;
}
예제 #16
0
int ICtl_ribbon_toolbar::ICtl_wxctrl_itemdata::UpdateCtrl()
{
	if (pevt->m_nId<0)
	{
		return 0;
	}

	if (!tbar) return 0;
	tbar->SetToolHelpString(pevt->m_nId, str2wx(pevt->MakeLabel(EvtBase::LABEL_TOOL)));

	if (pevt->flags.get(EvtBase::FLAG_CHECK))
	{
		tbar->ToggleTool(pevt->m_nId, pevt->flags.get(EvtBase::FLAG_CHECKED));
	}

	tbar->EnableTool(pevt->m_nId, !pevt->flags.get(EvtBase::FLAG_DISABLE | EvtBase::FLAG_HIDE_UI));

	return 0;
}
예제 #17
0
	ICtl_ribbon_page* find2(const String& name)
	{
		ICtl_ribbon_page* p = NULL;
		for (size_t i = 0; i < pages.size(); i++)
		{
			if (pages[i]->name == name)
			{
				p = pages[i];
				break;
			}
		}
		if (!p)
		{
			p = new ICtl_ribbon_page(name);
			p->Create(this, wxID_ANY, str2wx(Translate(name)), wxNullBitmap);
			pages.push_back(p);
		}
		return p;
	}
예제 #18
0
bool MvcBook::AttachView(MvcView* pView)
{
	if(!pView)
	{
		System::LogDebug("MvcBook::AttachView: pView is NULL");
		return false;
	}

	m_aOpenedViews.insert(pView);

	wxWindow* pCanvas=pView->CreateCanvas(m_pBook.get());
	pView->SetCanvas(pCanvas);

	bool flag=m_pBook->AddPage(pCanvas,str2wx(pView->GetTitle()),true,-1);

	if(!flag)
	{
		System::LogMessage("MvcBook::AttachView: m_pBook->AddPage failed");
	}
	return flag;
}
예제 #19
0
bool ICtl_ribbon_toolbar::AddCtrlItem(EvtGroup* pevt)
{
	const BitmapBundle& bundle(pevt->GetBundle(16,1));
	wxRibbonToolBarToolBase* item = m_p_wx_impl->AddTool(pevt->m_nId, bundle.bmp_normal, bundle.bmp_disabled, str2wx(pevt->MakeLabel()), wxRIBBON_BUTTON_DROPDOWN);
	InitToolItem(pevt, item);
	return true;
}
예제 #20
0
void IWnd_stc::UpdateStyle()
{

	bool flag=param.nlang==tempp.nlang 
		&& (param.flags.get(FLAG_FOLD)==tempp.flags.get(FLAG_FOLD)) 
		&& (param.flags.get(FLAG_SYNTAX)==tempp.flags.get(FLAG_SYNTAX)) 
		&& param.nsize==tempp.nsize;

	param=tempp;	

	if(flag)
	{
		_DoUpdateStyle();
		return;
	}


	BitFlags& flags(param.flags);

	StcLangInfo& lf(StcManager::current().langs[param.nlang]);

	wxFont fontNr (param.nsize, wxMODERN, wxNORMAL, wxNORMAL,false,str2wx(param.sface));
    for (int Nr = 0; Nr < wxSTC_STYLE_LASTPREDEFINED; Nr++)
	{
        StyleSetFont (Nr, fontNr);
    }

	if(!flags.get(FLAG_FOLD))
	{
		ClearDocumentStyle();
	}

    StyleClearAll();
    SetLexer (lf.lexer);

    SetMarginType (StcManager::LINE_NR_ID, wxSTC_MARGIN_NUMBER);
    StyleSetForeground (wxSTC_STYLE_LINENUMBER, wxColour (wxT("DARK GREY")));
    StyleSetBackground (wxSTC_STYLE_LINENUMBER, *wxWHITE);
    SetMarginWidth (StcManager::LINE_NR_ID, 0);

    // set common styles
    StyleSetForeground (wxSTC_STYLE_DEFAULT, wxColour (wxT("DARK GREY")));
    StyleSetForeground (wxSTC_STYLE_INDENTGUIDE, wxColour (wxT("DARK GREY")));

	SetMarginType(StcManager::DIVIDER_ID, wxSTC_MARGIN_SYMBOL);
	SetMarginMask(StcManager::DIVIDER_ID, wxSTC_MASK_FOLDERS);
    SetMarginWidth (StcManager::DIVIDER_ID, 0);
    SetMarginSensitive (StcManager::DIVIDER_ID, false);

    // folding
    SetMarginType (StcManager::FOLDING_ID, wxSTC_MARGIN_SYMBOL);
    SetMarginMask (StcManager::FOLDING_ID, wxSTC_MASK_FOLDERS);
    StyleSetBackground (StcManager::FOLDING_ID, *wxWHITE);
    SetMarginWidth (StcManager::FOLDING_ID, 0);
    SetMarginSensitive (StcManager::FOLDING_ID, false);

	if (flags.get(FLAG_FOLD)) 
	{

		SetMarginWidth (StcManager::FOLDING_ID,StcManager::FOLDING_MARGIN);
		SetMarginSensitive (StcManager::FOLDING_ID, true);

		SetPropertyEx ("fold", true);
		SetPropertyEx ("fold.comment",true);
		SetPropertyEx ("fold.compact",true);
		SetPropertyEx ("fold.preprocessor",true);
		SetPropertyEx ("fold.html", true);
		SetPropertyEx ("fold.html.preprocessor",true);
		SetPropertyEx ("fold.comment.python", true);
		SetPropertyEx ("fold.quotes.python", true);
	}
	else
	{
		SetMarginWidth (StcManager::DIVIDER_ID, StcManager::FOLDING_MARGIN);
	}

	SetFoldFlags (wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED| wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);

	if (flags.get(FLAG_SYNTAX))
	{
		int keywordnr = 0;

		for(StcLangInfo::map_type::iterator it=lf.mapStyles.begin();it!=lf.mapStyles.end();++it)
		{
			int Nr=(*it).first;
			StcLangInfo::StyleWords& s((*it).second);
			StcStyleInfo& curType(StcManager::current().style[s.id]);

			wxFont font (param.nsize, wxMODERN, wxNORMAL, wxNORMAL, false,str2wx(curType.fontname));

			StyleSetFont (Nr, font);
			if (curType.foreground!=wxEmptyString) 
			{
				StyleSetForeground (Nr, wxColour (curType.foreground.c_str()));
			}
			if (curType.background!=wxEmptyString) 
			{
				StyleSetBackground (Nr, wxColour (curType.background.c_str()));
			}

			StyleSetBold (Nr, curType.fontstyle.get(StcManager::STYLE_BOLD));
			StyleSetItalic (Nr, curType.fontstyle.get(StcManager::STYLE_ITALIC));
			StyleSetUnderline (Nr, curType.fontstyle.get(StcManager::STYLE_UNDERL));
			StyleSetVisible (Nr, !curType.fontstyle.get(StcManager::STYLE_HIDDEN));

			//StyleSetCase (Nr, curType.lettercase);
			if (s.words!="") 
			{
				SetKeyWords (keywordnr, str2wx(s.words));
				keywordnr += 1;
			}
		}
	}

	_DoUpdateStyle();

	Colourise(0,this->GetLastPosition());

}
예제 #21
0
	virtual void GetValue(const itemtype& val,ICellInfo &cell) const
	{
		cell.variant=str2wx(val.m_tStamp.Format("%H:%M:%S"));
	}
예제 #22
0
void IWnd_stc::SetPropertyEx(const String& id,bool f)
{
	SetProperty(str2wx(id),f?"1":"0");
}
예제 #23
0
파일: mvc_book.cpp 프로젝트: hanwd/ew_base
void MvcBook::UpdateTitle()
{
	MvcView* pView=m_pBook->m_pActiveView;
	if(!pView) return;


	ViewInfo& vinfo(m_aOpenedViews[pView]);

	String title = pView->GetTitle();
	if (vinfo.title != title)
	{
		vinfo.title = title;
		vinfo.index = -1;
	}

	vinfo.dirty=pView->Target.TestId(CmdProc::CP_DIRTY);

	
	class MyViewInfoLess
	{
	public:
		bool operator()(ViewInfo* lhs, ViewInfo* rhs)
		{
			if (lhs->index < rhs->index) return true;
			if (lhs->index > rhs->index) return false;
			return lhs->timestamp < rhs->timestamp;
		}
	};

	bst_map<String, bst_set<ViewInfo*, MyViewInfoLess> > ainfo;
	for (auto it = m_aOpenedViews.begin(); it != m_aOpenedViews.end(); ++it)
	{
		ainfo[(*it).second.title].insert(&(*it).second);
	}
	for (auto it = ainfo.begin(); it != ainfo.end(); it++)
	{
		bst_set<ViewInfo*, MyViewInfoLess>& ainfo((*it).second);
		if (ainfo.size() == 1)
		{
			(*ainfo.begin())->index = -1;
			continue;
		}

		int n = (*ainfo.rbegin())->index;
		for (auto it = ainfo.begin(); it != ainfo.end() && (*it)->index < 0; ++it)
		{
			(*it)->index = ++n;
		}

	}


	for (view_map::iterator it = m_aOpenedViews.begin(); it != m_aOpenedViews.end(); ++it)
	{
		ViewInfo& vinfo((*it).second);
		String title;
		if (vinfo.dirty) title << "* ";
		else  title << "  ";

		title << vinfo.title;
		if (vinfo.index >= 0)
		{
			title << ":" << vinfo.index;
		}
		if (title == vinfo.title_n) continue;
		vinfo.title_n = title;

		wxWindow* pCanvas = (*it).first->GetCanvas();
		int id = m_pBook->GetPageIndex(pCanvas);
		if (id >= 0)
		{
			m_pBook->SetPageText(id, str2wx(title));
		}
		else
		{
			System::LogTrace("canvas not found");
		}
	}

}
예제 #24
0
	virtual void GetValue(const itemtype& val,ICellInfo &cell) const
	{
		cell.variant=str2wx(val.m_sMessage);
	}
예제 #25
0
	virtual void GetValue(const itemtype& val,ICellInfo &cell) const
	{
		cell.variant=str2wx(LogSource::current()[val.m_nSrc]);
	}