File: codedesigneritemdlg.cpp

package info (click to toggle)
codelite 14.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 112,816 kB
  • sloc: cpp: 483,662; ansic: 150,144; php: 9,569; lex: 4,186; python: 3,417; yacc: 2,820; sh: 1,147; makefile: 52; xml: 13
file content (94 lines) | stat: -rw-r--r-- 2,544 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "codedesigneritemdlg.h"
#include "project.h"
#include "virtualdirectoryselector.h"
#include "imanager.h"
#include "globals.h"

CodeDesignerItemDlg::CodeDesignerItemDlg(wxWindow *parent, IManager *mgr, bool allowmain)
	: CodeDesignerItemBaseDlg(parent)
{
	m_AllowMain = allowmain;
	m_mgr = mgr;
}

CodeDesignerItemDlg::~CodeDesignerItemDlg()
{
}

void CodeDesignerItemDlg::OnCancel(wxCommandEvent& event)
{
	EndModal( wxID_CANCEL );
}

void CodeDesignerItemDlg::OnInit(wxInitDialogEvent& event)
{
	TreeItemInfo item = m_mgr->GetSelectedTreeItemInfo( TreeFileView );
	if ( item.m_item.IsOk() && item.m_itemType == ProjectItem::TypeVirtualDirectory )
	{
		m_textTreeFolder->SetValue(VirtualDirectorySelector::DoGetPath( m_mgr->GetTree( TreeFileView ), item.m_item, false ));
	}

	m_textPackageName->SetValue( m_CDInfo.m_PackageName );
	m_checkGenerate->SetValue( true );

	event.Skip();
}

void CodeDesignerItemDlg::OnOk(wxCommandEvent& event)
{
	if( m_textDiagramName->GetValue().IsEmpty() )
	{
		wxMessageBox( _("Diagram name cannot be empty"), _("CodeLite"), wxICON_WARNING | wxOK );
		m_textDiagramName->SetFocus();
		return;
	}

	if( m_textPackageName->GetValue().IsEmpty() )
	{
		wxMessageBox( _("Package name cannot be empty"), _("CodeLite"), wxICON_WARNING | wxOK );
		m_textPackageName->SetFocus();
		return;
	}

	if( m_textTreeFolder->GetValue().IsEmpty() )
	{
		wxMessageBox( _("Folder name cannot be empty"), _("CodeLite"), wxICON_WARNING | wxOK );
		m_textTreeFolder->SetFocus();
		return;
	}

	m_CDInfo.m_DiagramName = m_textDiagramName->GetValue();
	m_CDInfo.m_PackageName = m_textPackageName->GetValue();
	m_CDInfo.m_TreeFolderName = m_textTreeFolder->GetValue();
	m_CDInfo.m_UseMain = m_checkBoxMain->GetValue();
	m_CDInfo.m_GenerateCode = m_checkGenerate->GetValue();
	
	if( m_choiceLanguage->GetStringSelection() == wxT("C") )
	{
		m_CDInfo.m_Language = wxT("udCLanguage");
	}
	else if( m_choiceLanguage->GetStringSelection() == wxT("C++") )
	{
		m_CDInfo.m_Language = wxT("udCPPLanguage");
	}
	else if( m_choiceLanguage->GetStringSelection() == wxT("Python") )
	{
		m_CDInfo.m_Language = wxT("udPythonLanguage");
	}

	EndModal( wxID_OK );
}

void CodeDesignerItemDlg::OnUpdateMain(wxUpdateUIEvent& event)
{
	event.Enable( m_AllowMain );
}

void CodeDesignerItemDlg::OnBrowse(wxCommandEvent& event)
{
	VirtualDirectorySelector dlg(this, m_mgr->GetWorkspace(), m_textTreeFolder->GetValue());
	if ( dlg.ShowModal() == wxID_OK )
	{
		m_textTreeFolder->SetValue( dlg.GetVirtualDirectoryPath() );
	}
}