From 0fab7df44eaa11945d2c2f745c82ecf9e0a8ffe8 Mon Sep 17 00:00:00 2001 From: totoro Date: Tue, 7 Mar 2017 21:19:27 +0100 Subject: [PATCH] rename menu as hk_menu --- calexium_lib | 2 +- hayamiki_generator.aproj | 2 +- hayamiki_lib | 2 +- src/generation/files.anubis | 4 ++-- src/generation/hk_menu.anubis | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/generation/menu.anubis | 88 ---------------------------------------------------------------------------------------- 6 files changed, 93 insertions(+), 93 deletions(-) create mode 100644 src/generation/hk_menu.anubis delete mode 100644 src/generation/menu.anubis diff --git a/calexium_lib b/calexium_lib index 6269896..5b85c04 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit 626989691473574cf1896048f55f618bd1a9a6c7 +Subproject commit 5b85c04ccb6f2723207bb2b0640de7ec64850665 diff --git a/hayamiki_generator.aproj b/hayamiki_generator.aproj index 6480a56..77af4f0 100644 --- a/hayamiki_generator.aproj +++ b/hayamiki_generator.aproj @@ -494,9 +494,9 @@ + - diff --git a/hayamiki_lib b/hayamiki_lib index 523830e..9ab9ecc 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit 523830e5bcc852cc87262ed92f96d7a0ec0d0032 +Subproject commit 9ab9ecc773adfda2d84d6cd559b1fe7ef305880e diff --git a/src/generation/files.anubis b/src/generation/files.anubis index a8ce8fd..06f0468 100644 --- a/src/generation/files.anubis +++ b/src/generation/files.anubis @@ -20,7 +20,7 @@ read generation/header.anubis read generation/types.anubis read generation/densaku.anubis read generation/create_table.anubis -read generation/menu.anubis +read generation/hk_menu.anubis read generation/fn_delete.anubis read generation/choices_selector.anubis read generation/vt_edit.anubis @@ -237,7 +237,7 @@ define Maybe(One) println("Generating create for Database "+name); if generate_create_table(apps, destination_dir) is failure then println("failure");failure else println("Generating menu for Database "+name); - if generate_menus(apps, destination_dir) is failure then println("failure");failure else + if generate_hk_menus(apps, destination_dir) is failure then println("failure");failure else writeString(ini, "DB_MODEL", "SHA1", current_db_SHA1); writeIniInfo(ini); success(unique) diff --git a/src/generation/hk_menu.anubis b/src/generation/hk_menu.anubis new file mode 100644 index 0000000..bcf7b49 --- /dev/null +++ b/src/generation/hk_menu.anubis @@ -0,0 +1,88 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 06/02/2016 + * Time: 15:40 + * © Calexium + */ + +read hayamiki_lib/types/hayamiki.anubis +read tools/basis.anubis +read tools/int.anubis +read system/string.anubis +read system/files.anubis +read tools/streams.anubis +read tools/ISO-8601.anubis + +read utils/utils.anubis + +define String + generate_application_menu + ( + List(HK_App) apps, +// List(HK_Table) tables, //list of the table model description + String indent + )= + // hk_menu_list("111", help_text("222"), + // [ + // hk_menu_item("production_mass_storage", "view_table", "CURRENT", [("table_name", "production_mass_storage", ),("view_name", "current")]), + + //calculate then longest table name and add 4 for enclosed quote + coma + final space + //hence we can make a beautiful formatting + with max_space = longest_table_name_size(apps, 0) + 4, + + join(",\n", + map((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), + indent+"hk_menu_list("+to_String(icon)+", "+ + //determine if there is help text for app. If not we use the App name as menu entry + with app_menu_name = if help is no_help_text then help_text(to_upper(if app_name ="" then "base" else app_name)) else help, + to_Anubis_source(app_menu_name)+",\n"+indent+"[\n"+ + join(",\n", + map_append((HK_Table table) |-> + since table is hk_table(table_name, short_name, model, display), + since display is hk_display(list_views, _), + map((HK_List_View view ) |-> + with view_name = if view is list_view(v_name, _, _) then v_name else "default", + indent+" "+"hk_menu_item("+fill("\""+table_name+"\",",max_space)+ "\"view_table\", "+ + fill("help_text(\""+short_name+(if view_name="default" then "" else " "+view_name)+"\"),",max_space)+ + "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))+"\n"+indent+"])", apps)). + + +public define Maybe(One) + generate_hk_menus + ( + List(HK_App) apps, //list of the table model description + String dest_dir + )= + + with file_name = dest_dir+"web_pages/generated/apps_menu.anubis", + + //create all necessary directories if doesn't exist. + make_directories(file_name); + + //create script file name as new file. Previous file with same name will be erased + if file(file_name, new) is + { + failure then println("Can't create menu "+file_name);failure, + success(fd) then + with stream = make_stream(fd), + + write_string(stream, +"/* + * Created by 早見木 (Hayamiki). + * Date: "+_Int_to_ISO_8601_date(now)+" + * Time: "+_Int_to_ISO_8601_time(now)+" + */ + +transmit types/hk_menu_types.anubis + +public define HK_Menu_Item + applications_menu + = + hk_menu_list(\"managers\", help_text_TAG(\"APPLICATIONS\"), + [\n"+ + generate_application_menu(apps, " ")+"\n + ]).\n") + } + +. diff --git a/src/generation/menu.anubis b/src/generation/menu.anubis deleted file mode 100644 index dc61d60..0000000 --- a/src/generation/menu.anubis +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Created by PyramIDE. - * User: フランスのトトロ - * Date: 06/02/2016 - * Time: 15:40 - * © Calexium - */ - -read hayamiki_lib/types/hayamiki.anubis -read tools/basis.anubis -read tools/int.anubis -read system/string.anubis -read system/files.anubis -read tools/streams.anubis -read tools/ISO-8601.anubis - -read utils/utils.anubis - -define String - generate_application_menu - ( - List(HK_App) apps, -// List(HK_Table) tables, //list of the table model description - String indent - )= - // hk_menu_list("111", help_text("222"), - // [ - // hk_menu_item("production_mass_storage", "view_table", "CURRENT", [("table_name", "production_mass_storage", ),("view_name", "current")]), - - //calculate then longest table name and add 4 for enclosed quote + coma + final space - //hence we can make a beautiful formatting - with max_space = longest_table_name_size(apps, 0) + 4, - - join(",\n", - map((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), - indent+"hk_menu_list("+to_String(icon)+", "+ - //determine if there is help text for app. If not we use the App name as menu entry - with app_menu_name = if help is no_help_text then help_text(to_upper(if app_name ="" then "base" else app_name)) else help, - to_Anubis_source(app_menu_name)+",\n"+indent+"[\n"+ - join(",\n", - map_append((HK_Table table) |-> - since table is hk_table(table_name, short_name, model, display), - since display is hk_display(list_views, _), - map((HK_List_View view ) |-> - with view_name = if view is list_view(v_name, _, _) then v_name else "default", - indent+" "+"hk_menu_item("+fill("\""+table_name+"\",",max_space)+ "\"view_table\", "+ - fill("help_text(\""+short_name+(if view_name="default" then "" else " "+view_name)+"\"),",max_space)+ - "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))+"\n"+indent+"])", apps)). - - -public define Maybe(One) - generate_menus - ( - List(HK_App) apps, //list of the table model description - String dest_dir - )= - - with file_name = dest_dir+"web_pages/generated/apps_menu.anubis", - - //create all necessary directories if doesn't exist. - make_directories(file_name); - - //create script file name as new file. Previous file with same name will be erased - if file(file_name, new) is - { - failure then println("Can't create menu "+file_name);failure, - success(fd) then - with stream = make_stream(fd), - - write_string(stream, -"/* - * Created by 早見木 (Hayamiki). - * Date: "+_Int_to_ISO_8601_date(now)+" - * Time: "+_Int_to_ISO_8601_time(now)+" - */ - -transmit types/hk_menu_types.anubis - -public define HK_Menu_Item - applications_menu - = - hk_menu_list(\"managers\", help_text_TAG(\"APPLICATIONS\"), - [\n"+ - generate_application_menu(apps, " ")+"\n - ]).\n") - } - -. -- libgit2 0.21.4