Skip to content

Commit

Permalink
Developing 0.19.0
Browse files Browse the repository at this point in the history
linked nana 1.7.1
update filebox/folderbox to new version
propertygrid: added tooltip ans set functions (thanks to: JamesBremner)
propertygrid: now properties are update also on focus lost (thanks to: JamesBremner)
items_dialog: new add item/separator method. Now item/separator is added at the same level of the selected item
items_dialog: fixed bug in menubar. Now separator can only be added to submenu
  • Loading branch information
besh81 committed May 3, 2019
1 parent bbe22fe commit 2c8662e
Show file tree
Hide file tree
Showing 25 changed files with 515 additions and 261 deletions.
6 changes: 2 additions & 4 deletions build/codeblocks_linux/nana_creator.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,14 @@
<Unit filename="../../src/new_project.h" />
<Unit filename="../../src/objectspanel.cpp" />
<Unit filename="../../src/objectspanel.h" />
<Unit filename="../../src/pg_items.cpp" />
<Unit filename="../../src/pg_items.h" />
<Unit filename="../../src/pgitems_creator.cpp" />
<Unit filename="../../src/pgitems_creator.h" />
<Unit filename="../../src/propertiespanel.cpp" />
<Unit filename="../../src/propertiespanel.h" />
<Unit filename="../../src/propertygrid_helper.cpp" />
<Unit filename="../../src/propertygrid_helper.h" />
<Unit filename="../../src/resizablecanvas.cpp" />
<Unit filename="../../src/resizablecanvas.h" />
<Unit filename="../../src/statusbar.cpp" />
<Unit filename="../../src/statusbar.h" />
<Unit filename="../../src/style.h" />
<Unit filename="../../src/tree.h" />
<Extensions>
Expand Down
5 changes: 3 additions & 2 deletions build/codeblocks_win/nana_creator.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
<Compiler>
<Add option="-Wall" />
<Add option="-std=c++11" />
<Add directory="../../src/ctrls" />
<Add directory="../../src/nana_extra" />
<Add directory="../../src" />
<Add directory="../../libs" />
</Compiler>
<Linker>
<Add library="png" />
<Add library="jpeg" />
<Add library="nana" />
<Add library="gdi32" />
Expand Down Expand Up @@ -135,8 +138,6 @@
<Unit filename="../../src/propertygrid_helper.h" />
<Unit filename="../../src/resizablecanvas.cpp" />
<Unit filename="../../src/resizablecanvas.h" />
<Unit filename="../../src/statusbar.cpp" />
<Unit filename="../../src/statusbar.h" />
<Unit filename="../../src/style.h" />
<Unit filename="../../src/tree.h" />
<Extensions>
Expand Down
2 changes: 0 additions & 2 deletions build/vc2015/nana_creator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@
<ClCompile Include="..\..\src\propertiespanel.cpp" />
<ClCompile Include="..\..\src\propertygrid_helper.cpp" />
<ClCompile Include="..\..\src\resizablecanvas.cpp" />
<ClCompile Include="..\..\src\statusbar.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\libs\pugixml\pugiconfig.hpp" />
Expand Down Expand Up @@ -239,7 +238,6 @@
<ClInclude Include="..\..\src\propertiespanel.h" />
<ClInclude Include="..\..\src\propertygrid_helper.h" />
<ClInclude Include="..\..\src\resizablecanvas.h" />
<ClInclude Include="..\..\src\statusbar.h" />
<ClInclude Include="..\..\src\style.h" />
<ClInclude Include="..\..\src\tree.h" />
</ItemGroup>
Expand Down
6 changes: 0 additions & 6 deletions build/vc2015/nana_creator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@
<ClCompile Include="..\..\src\filemanager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\statusbar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ctrls\box_model.cpp">
<Filter>Source Files\ctrls</Filter>
</ClCompile>
Expand Down Expand Up @@ -293,9 +290,6 @@
<ClInclude Include="..\..\src\filemanager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\statusbar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ctrls\box_model.h">
<Filter>Header Files\ctrls</Filter>
</ClInclude>
Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


#define CREATOR_NAME "Nana Creator"
#define CREATOR_VERSION "0.18.1"
#define CREATOR_VERSION "0.19.0"



Expand Down
80 changes: 44 additions & 36 deletions src/creator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
#define TB_PASTE 14


guimanager* p_gui_mgr; // manage all the gui elements
guimanager* p_gui_mgr; // manage all the gui elements
nana::filebox::path_type prj_name;

extern inifile g_inifile;

extern inifile g_inifile;


void creator::enableGUI(bool state, bool new_load)
Expand Down Expand Up @@ -96,18 +97,25 @@ bool creator::save_xml(const std::string& filename)

bool creator::generate_cpp()
{
std::string path;
auto tpos = _prj_name.find_last_of("\\/");
if(tpos != _prj_name.npos)
path = _prj_name.substr(0, tpos);

codegenerator cpp;
cpp.generate(handle(), p_gui_mgr->get_root()->child, path);
cpp.generate(handle(), p_gui_mgr->get_root()->child, prj_name.parent_path().string());
cpp.print(std::cout);
return true;
}


void creator::sb_clear()
{
_sb.caption("");
}


void creator::sb_set(const std::string& str)
{
_sb.caption(str);
}


void creator::_init_ctrls()
{
caption(CREATOR_NAME " " CREATOR_VERSION);
Expand All @@ -118,7 +126,7 @@ void creator::_init_ctrls()
if(arg.button == TB_NEW) // new project
{
// confirmation message
if(_prj_name != "")
if(prj_name != "")
{
nana::msgbox m(*this, "Save project", nana::msgbox::yes_no_cancel);
m.icon(m.icon_warning);
Expand All @@ -127,29 +135,29 @@ void creator::_init_ctrls()
if(ret == nana::msgbox::pick_cancel)
return;
else if(ret == nana::msgbox::pick_yes)
save_xml(_prj_name);
save_xml(prj_name.string());
}

p_gui_mgr->clear();
_prj_name = "";
prj_name = "";

new_project dlg(*this);
dlg.modality();

if(dlg.return_val() == nana::msgbox::pick_ok)
{
_prj_name = dlg.get_filename();
prj_name = dlg.get_filename();

p_gui_mgr->new_project(dlg.get_ctrl_type(), dlg.get_projectname());

// crea file di progetto
save_xml(_prj_name);
save_xml(prj_name.string());
}
}
else if(arg.button == TB_LOAD) // load project
{
// confirmation message
if(_prj_name != "")
if(prj_name != "")
{
nana::msgbox m(*this, "Save project", nana::msgbox::yes_no_cancel);
m.icon(m.icon_warning);
Expand All @@ -158,11 +166,11 @@ void creator::_init_ctrls()
if(ret == nana::msgbox::pick_cancel)
return;
else if(ret == nana::msgbox::pick_yes)
save_xml(_prj_name);
save_xml(prj_name.string());
}

p_gui_mgr->clear();
_prj_name = "";
prj_name = "";

nana::filebox fb(*this, true);
fb.add_filter("Nana Creator Project (*." PROJECT_EXT ")", "*." PROJECT_EXT);
Expand All @@ -176,43 +184,44 @@ void creator::_init_ctrls()
fb.init_path(equalize_path(g_inifile.load_project_dir()));
#endif

if(fb())
auto paths = fb.show();
if(!paths.empty())
{
// save load_project folder
auto path = get_dir_path(equalize_path(fb.file()));
if(path != g_inifile.load_project_dir())
g_inifile.load_project_dir(path, true);
prj_name = paths[0];
if(prj_name.parent_path().string() != g_inifile.load_project_dir())
g_inifile.load_project_dir(prj_name.parent_path().string(), true);

_prj_name = fb.file();
if(!load_xml(_prj_name))
_prj_name = "";
if(!load_xml(prj_name.string()))
prj_name = "";
}
}
else if(arg.button == TB_SAVE) // save project
{
if(_prj_name == "")
if(prj_name == "")
return;

save_xml(_prj_name);
save_xml(prj_name.string());
}
else if(arg.button == TB_SAVE_AS) // save project as
{
if(_prj_name == "")
if(prj_name == "")
return;

nana::filebox fb(*this, false);
fb.add_filter("Nana Creator Project (*." PROJECT_EXT ")", "*." PROJECT_EXT);
fb.init_file(_prj_name);
fb.init_file(prj_name.string());

if(fb())
auto paths = fb.show();
if(!paths.empty())
{
_prj_name = fb.file();
save_xml(_prj_name);
prj_name = paths[0];
save_xml(prj_name.string());
}
}
else if(arg.button == TB_GENERATE) // generate code
{
if(_prj_name == "")
if(prj_name == "")
return;

generate_cpp();
Expand Down Expand Up @@ -255,14 +264,13 @@ void creator::_init_ctrls()
// canvas
_place.field("canvas") << _canvas;

// statusbar
_statusbar.set("Ready");
_place.field("statusbar") << _statusbar;

_place.collocate();


p_gui_mgr = new guimanager(*this);
p_gui_mgr->init(this, &_properties, &_assets, &_objects, &_canvas, &_statusbar);
p_gui_mgr->init(this, &_properties, &_assets, &_objects, &_canvas);

sb_set("Ready");
}


Expand Down
14 changes: 9 additions & 5 deletions src/creator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*****************************************************
* C++ code generated with Nana Creator (0.17.0)
* C++ code generated with Nana Creator (0.19.0)
* GitHub repo: https://github.com/besh81/nana-creator
*
* PLEASE EDIT ONLY INSIDE THE TAGS:
Expand All @@ -14,13 +14,13 @@
#include <nana/gui.hpp>
#include <nana/gui/place.hpp>
#include <nana/gui/widgets/toolbar.hpp>
#include <nana/gui/widgets/label.hpp>

//<*includes
#include "resizablecanvas.h"
#include "propertiespanel.h"
#include "assetspanel.h"
#include "objectspanel.h"
#include "statusbar.h"
//*>


Expand Down Expand Up @@ -70,6 +70,10 @@ class creator
_tb.append("Cut current selection", nana::paint::image("icons/cut.png"));
_tb.append("Copy current selection", nana::paint::image("icons/copy.png"));
_tb.append("Paste into/after current selection", nana::paint::image("icons/paste.png"));
// _sb
_sb.create(*this);
_place["statusbar"] << _sb;
_sb.caption("");

_place.collocate();
}
Expand All @@ -78,6 +82,7 @@ class creator
protected:
nana::place _place{ *this };
nana::toolbar _tb;
nana::label _sb;


//<*declarations
Expand All @@ -88,20 +93,19 @@ class creator

bool generate_cpp();

void sb_clear();
void sb_set(const std::string& str);

private:
void _init_ctrls();
void _destroy_ctrls();

std::string _prj_name;

resizablecanvas _canvas{ *this };

assetspanel _assets{ *this };
objectspanel _objects{ *this };
propertiespanel _properties{ *this };

statusbar _statusbar{ *this };
//*>
};

Expand Down
36 changes: 19 additions & 17 deletions src/creator.ncp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0"?>
<nana-creator version="0.17.0">
<nana-creator version="0.19.0">
<form mainclass="true" filename="creator" rel_path="true" work_dir="F:\C++ Projects\nana-creator\wdir" type="form" name="creator" enabled="true" caption="Nana Creator" width="800" height="500" bgcolor="212,208,200" fgcolor="0,0,0" decoration="true" taskbar="true" floating="false" no_activate="false" min="true" max="true" sizable="true" layout="1" margin="0" gap="0">
<field type="field" name="toolbar" weight="30" layout="0" margin="0" gap="0">
<toolbar type="toolbar" name="_tb" enabled="true" bgcolor="212,208,200" fgcolor="0,0,0" f_size="9" f_weight="400" f_italic="false" f_underline="false" f_strike_out="false" weight="-1" buttons="" scale="21">
<item type="button" key="n1" owner="" text="New project" image="F:\C++ Projects\nana-creator\wdir\icons\new_prj.png" separator="false" />
<item type="button" key="n2" owner="" text="Load project" image="F:\C++ Projects\nana-creator\wdir\icons\load_prj.png" separator="false" />
<item type="button" key="n3" owner="" text="Save project" image="F:\C++ Projects\nana-creator\wdir\icons\save.png" separator="false" />
<item type="button" key="n4" owner="" text="Save project as..." image="F:\C++ Projects\nana-creator\wdir\icons\save_as.png" separator="false" />
<item type="button" key="n5" owner="" text="-----" image="" separator="true" />
<item type="button" key="n6" owner="" text="Generate C++ code" image="F:\C++ Projects\nana-creator\wdir\icons\output_on.png" separator="false" />
<item type="button" key="n7" owner="" text="-----" image="" separator="true" />
<item type="button" key="n8" owner="" text="Delete current selection" image="F:\C++ Projects\nana-creator\wdir\icons\delete.png" separator="false" />
<item type="button" key="n9" owner="" text="-----" image="" separator="true" />
<item type="button" key="n10" owner="" text="Move up current selection" image="F:\C++ Projects\nana-creator\wdir\icons\up.png" separator="false" />
<item type="button" key="n11" owner="" text="Move down current selection" image="F:\C++ Projects\nana-creator\wdir\icons\down.png" separator="false" />
<item type="button" key="n12" owner="" text="-----" image="" separator="true" />
<item type="button" key="n13" owner="" text="Cut current selection" image="F:\C++ Projects\nana-creator\wdir\icons\cut.png" separator="false" />
<item type="button" key="n14" owner="" text="Copy current selection" image="F:\C++ Projects\nana-creator\wdir\icons\copy.png" separator="false" />
<item type="button" key="n15" owner="" text="Paste into/after current selection" image="F:\C++ Projects\nana-creator\wdir\icons\paste.png" separator="false" />
<item type="button" key="n1" owner="" text="New project" image="F:\C++ Projects\nana-creator\wdir\icons\new_prj.png" enable="true" separator="false" />
<item type="button" key="n2" owner="" text="Load project" image="F:\C++ Projects\nana-creator\wdir\icons\load_prj.png" enable="true" separator="false" />
<item type="button" key="n3" owner="" text="Save project" image="F:\C++ Projects\nana-creator\wdir\icons\save.png" enable="true" separator="false" />
<item type="button" key="n4" owner="" text="Save project as..." image="F:\C++ Projects\nana-creator\wdir\icons\save_as.png" enable="true" separator="false" />
<item type="button" key="n5" owner="" text="-----" image="" enable="true" separator="true" />
<item type="button" key="n6" owner="" text="Generate C++ code" image="F:\C++ Projects\nana-creator\wdir\icons\output_on.png" enable="true" separator="false" />
<item type="button" key="n7" owner="" text="-----" image="" enable="true" separator="true" />
<item type="button" key="n8" owner="" text="Delete current selection" image="F:\C++ Projects\nana-creator\wdir\icons\delete.png" enable="true" separator="false" />
<item type="button" key="n9" owner="" text="-----" image="" enable="true" separator="true" />
<item type="button" key="n10" owner="" text="Move up current selection" image="F:\C++ Projects\nana-creator\wdir\icons\up.png" enable="true" separator="false" />
<item type="button" key="n11" owner="" text="Move down current selection" image="F:\C++ Projects\nana-creator\wdir\icons\down.png" enable="true" separator="false" />
<item type="button" key="n12" owner="" text="-----" image="" enable="true" separator="true" />
<item type="button" key="n13" owner="" text="Cut current selection" image="F:\C++ Projects\nana-creator\wdir\icons\cut.png" enable="true" separator="false" />
<item type="button" key="n14" owner="" text="Copy current selection" image="F:\C++ Projects\nana-creator\wdir\icons\copy.png" enable="true" separator="false" />
<item type="button" key="n15" owner="" text="Paste into/after current selection" image="F:\C++ Projects\nana-creator\wdir\icons\paste.png" enable="true" separator="false" />
</toolbar>
</field>
<field type="field" name="main_field" weight="-1" layout="0" margin="0" gap="0">
Expand All @@ -31,6 +31,8 @@
<splitterbar type="splitterbar" name="splitterbar2" />
<field type="field" name="properties" weight="-1" layout="0" margin="0" gap="0" />
</field>
<field type="field" name="statusbar" weight="24" layout="0" margin="3" gap="0" />
<field type="field" name="statusbar" weight="24" layout="0" margin="3" gap="0">
<label type="label" name="_sb" enabled="true" bgcolor="212,208,200" fgcolor="0,0,0" f_size="9" f_weight="400" f_italic="false" f_underline="false" f_strike_out="false" weight="-1" caption="" format="false" transparent="false" halign="0" valign="0" />
</field>
</form>
</nana-creator>
Loading

0 comments on commit 2c8662e

Please sign in to comment.