bool EditorApplication::OnInit()
{
    COCA_DEBUG_INFO( "EditorApplication::OnInit" );

    SetAppName( "coca editor" );

    // coca resource manager
    _resourceManager.createThread();

    // frame
    EditorFrame* frame = new EditorFrame( 0, E_ID_EDITOR_FRAME, "coca editor",
                                          wxDefaultPosition, wxSize( 800, 600 ) );
    SetTopWindow( frame );

    readConfig();
    loadPlugins();
    createDocumentTemplates();
    _documentManager.SetMaxDocsOpen( 1 );

    frame->Show();

    COCA_DEBUG_INFO( "EditorApplication::OnInit finished" );

    return true;
}
Esempio n. 2
0
void MainBook::DetachActiveEditor()
{
    if(GetActiveEditor()) {
        LEditor* editor = GetActiveEditor();
        m_book->RemovePage(m_book->GetSelection(), true);
        EditorFrame* frame = new EditorFrame(clMainFrame::Get(), editor);
        frame->Show();
        m_detachedEditors.push_back(frame);
    }
}
Esempio n. 3
0
bool EditorApp::OnInit()
{
    //(*AppInitialize
    bool wxsOK = true;
    wxInitAllImageHandlers();
    if ( wxsOK )
    {
    	EditorFrame* Frame = new EditorFrame(0);
    	Frame->Show();
    	SetTopWindow(Frame);
    }
    //*)
    return wxsOK;

}
Esempio n. 4
0
void BdayFrame::editFile( const wxFileName & file, const wxString & title )
{
  wxWindowList & wnds = GetChildren();
  for ( wxWindowList::iterator it = wnds.begin(); it != wnds.end(); ++it )
    if ( ( *it )->IsKindOf(CLASSINFO(wxFrame)) )
      if ( ((wxFrame *)( *it ))->GetTitle().IsSameAs(title) )
      {
        ( *it )->Raise();
        return;
      }
  EditorFrame * frame = new EditorFrame(this, file, title);
  if ( frame->hasError() )
  {
    wxMessageDialog mb(this, frame->getError(), GetTitle(), wxOK| wxICON_ERROR);
    mb.ShowModal();
  }
  else
  {
    frame->Show(true);
  }
}
Esempio n. 5
0
void startDialog::on_ScriptEdit_clicked()
{
	EditorFrame *pMain = new EditorFrame();
	pMain->setHostWidget(this);
	pMain->setAttribute(Qt::WA_DeleteOnClose, true);

	if (!loadDataBase()) {
		nd_logerror("load database error\n");
	}

	std::string defProj = getPathFromConfig("script_root");

	if (!defProj.empty() && pMain->myInit(defProj.c_str() )) {
		this->setVisible(false);
		pMain->showMaximized();
	}
	else {
		delete pMain;
	}

}
Esempio n. 6
0
void ApiHandler::IpcEditorShowInputLine(EditorCtrl& , IConnection& conn) {
	const hessian_ipc::Call& call = *conn.get_call();

	// Get caption
	const hessian_ipc::Value& v2 = call.GetParameter(1);
	const string& t = v2.GetString();
	const wxString caption(t.c_str(), wxConvUTF8, t.size());

	// Register notifier
	const unsigned int notifier_id = GetNextNotifierId();
	m_notifiers[notifier_id] = &conn;

	// Show input line
	EditorFrame* frame = m_app.GetTopFrame();
	if (!frame) return;

	frame->ShowInputPanel(notifier_id, caption);

	// Return notifier id
	hessian_ipc::Writer& writer = conn.get_reply_writer();
	writer.write_reply(notifier_id);
}
Esempio n. 7
0
int runEditor(int argc,  char *argv[])
{
	QApplication a(argc, argv);
	//workingConfigInit();
	initWorkingPath() ;

	if (__in_proj_path) {
		nd_chdir(__in_proj_path);
	}
	//load dbl data
// 	const char *package_file = apoEditorSetting::getInstant()->getValueFromSetting("game_data_package_file");
// 	if (package_file) {
// 		DBLDatabase::get_Instant()->LoadBinStream(package_file);
// 	}

	EditorFrame mainFrame;
	if (!mainFrame.myInit()) {
		QMessageBox::critical(NULL, "Error", "init setting error!");
		exit(1);
	}
	mainFrame.showMaximized();
	return a.exec();

}
Esempio n. 8
0
DiffPanel::DiffPanel(wxWindow* parent, EditorFrame& parentFrame, CatalystWrapper& cw, wxBitmap& bitmap):
	wxPanel(parent, wxID_ANY, wxPoint(-100,-100)), 
	m_parentFrame(&parentFrame), m_leftEditor(NULL), m_rightEditor(NULL), m_currentEditor(NULL) 
{
	Hide(); // Hidden during construction

	// Create ctrls
	m_leftEditor = new EditorCtrl(cw, bitmap, this, parentFrame);
	m_rightEditor = new EditorCtrl(cw, bitmap, this, parentFrame);
	m_leftEditor->SetScrollbarLeft();
	m_rightEditor->SetGutterRight();
	
	m_diffBar = new DiffBar(this, cw, m_leftEditor, m_rightEditor, parentFrame.GetSyntaxHandler());
	m_leftMarkBar = new DiffMarkBar(this, m_diffBar->GetLineMatches(), m_leftEditor, true);
	m_rightMarkBar = new DiffMarkBar(this, m_diffBar->GetLineMatches(), m_rightEditor, false);

	m_leftTitle = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
	m_rightTitle = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
	wxButton* swapButton = new wxButton(this, ID_BUTTON_SWAP, wxT("<->"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);

	m_currentEditor = m_leftEditor; // default focus is left

	// Layout sizers
	m_mainSizer = new wxGridBagSizer();
	{
		m_mainSizer->AddGrowableRow(1);
		m_mainSizer->AddGrowableCol(1);
		m_mainSizer->AddGrowableCol(3);

		m_mainSizer->Add(m_leftTitle, wxGBPosition(0,0), wxGBSpan(1,2), wxEXPAND);
		m_mainSizer->Add(swapButton, wxGBPosition(0,2));
		m_mainSizer->Add(m_rightTitle, wxGBPosition(0,3), wxGBSpan(1,2), wxEXPAND);

		m_mainSizer->Add(m_leftMarkBar, wxGBPosition(1,0), wxGBSpan(1,1), wxEXPAND);
		m_mainSizer->Add(m_leftEditor, wxGBPosition(1,1), wxGBSpan(1,1), wxEXPAND);
		m_mainSizer->Add(m_diffBar, wxGBPosition(1,2), wxGBSpan(1,1), wxEXPAND);
		m_mainSizer->Add(m_rightEditor, wxGBPosition(1,3), wxGBSpan(1,1), wxEXPAND);
		m_mainSizer->Add(m_rightMarkBar, wxGBPosition(1,4), wxGBSpan(1,1), wxEXPAND);
	}

	SetSizer(m_mainSizer);
}
Esempio n. 9
0
StatusBar::OtherTabDlg::OtherTabDlg(EditorFrame& parent)
: wxDialog (&parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER),
  m_parentFrame(parent) {
	const unsigned int width = parent.GetTabWidth();

	SetTitle (_("Other Tab Size"));

	wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);

	wxSlider* slider = new wxSlider(this, CTRL_SLIDER, width, 1, 32, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS|wxSL_AUTOTICKS);
	sizer->Add(slider, 1, wxEXPAND|wxALL, 10);

	sizer->Add(CreateButtonSizer(wxOK), 0, wxEXPAND|wxALL, 10);

	slider->SetFocus();
	SetSizerAndFit(sizer);
	SetSize(400, 50);
	Centre();

	ShowModal();
}
Esempio n. 10
0
bool startDialog::showScriptError(const char *scriptFile, const char *nodeDescript, const char *editorWorkingPath)
{
	nd_chdir(editorWorkingPath);

	EditorFrame *pMain = new EditorFrame();
	pMain->setHostWidget(this);
	pMain->setAttribute(Qt::WA_DeleteOnClose, true);
	
	if (pMain->myInit()) {
		this->setVisible(false);

		if (!pMain->showRuntimeError(scriptFile, nodeDescript)) {
			return false;
		}
		pMain->showMaximized();
	}
	else {
		delete pMain;
		return false;
	}
	return true;
}