diff --git a/app/src/gambas3/.lang/.pot b/app/src/gambas3/.lang/.pot index b55911859..ae979ca79 100644 --- a/app/src/gambas3/.lang/.pot +++ b/app/src/gambas3/.lang/.pot @@ -286,7 +286,7 @@ msgstr "" msgid "Provides" msgstr "" -#: CInsertColor.class:106 FEditor.form:409 FTextEditor.form:342 +#: CInsertColor.class:106 FEditor.form:409 FTextEditor.form:350 msgid "Insert color" msgstr "" @@ -377,7 +377,7 @@ msgstr "" #: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28 #: FSaveProjectAs.form:59 FSearch.class:838 FSelectExtraFile.form:40 #: FSelectIcon.form:87 FSnippet.form:57 FTableChooser.form:68 FText.form:41 -#: FTextEditor.class:496 FTranslate.class:636 Project.module:424 +#: FTextEditor.class:498 FTranslate.class:636 Project.module:424 msgid "Cancel" msgstr "" @@ -509,41 +509,41 @@ msgstr "" #: FCommit.form:91 FConflict.form:53 FConnectionEditor.form:361 #: FEditor.form:144 FForm.form:228 FIconEditor.form:103 FImageEditor.form:71 -#: FMenu.form:107 FOutput.form:58 FTextEditor.form:93 +#: FMenu.form:107 FOutput.form:58 FTextEditor.form:101 msgid "Cut" msgstr "" #: FCommit.form:97 FConflict.form:59 FConnectionEditor.form:146 #: FEditor.form:150 FForm.form:235 FIconEditor.form:111 FImageEditor.form:80 -#: FMenu.form:113 FOutput.form:65 FTextEditor.form:100 +#: FMenu.form:113 FOutput.form:65 FTextEditor.form:108 msgid "Copy" msgstr "" #: FCommit.form:103 FConflict.form:65 FConnectionEditor.form:382 #: FEditor.form:157 FForm.form:248 FIconEditor.form:119 FImageEditor.form:89 -#: FMenu.form:119 FOutput.form:72 FPasteTable.form:101 FTextEditor.form:107 +#: FMenu.form:119 FOutput.form:72 FPasteTable.form:101 FTextEditor.form:115 msgid "Paste" msgstr "" #: FCommit.form:109 FConflict.form:71 FConnectionEditor.form:389 #: FEditor.form:128 FForm.form:211 FIconEditor.form:87 FImageEditor.form:99 -#: FOption.form:611 FOutput.form:41 FTextEditor.form:76 +#: FOption.form:611 FOutput.form:41 FTextEditor.form:84 msgid "Undo" msgstr "" #: FCommit.form:115 FConflict.form:77 FConnectionEditor.form:396 #: FEditor.form:135 FForm.form:218 FImageEditor.form:107 FOutput.form:48 -#: FTextEditor.form:83 +#: FTextEditor.form:91 msgid "Redo" msgstr "" #: FCommit.form:121 FConflict.form:83 FEditor.form:434 FMenu.form:129 -#: FTextEditor.form:301 +#: FTextEditor.form:309 msgid "Indent" msgstr "" #: FCommit.form:127 FConflict.form:89 FEditor.form:442 FMenu.form:135 -#: FTextEditor.form:308 +#: FTextEditor.form:316 msgid "Unindent" msgstr "" @@ -665,13 +665,13 @@ msgstr "" #: FConnectionEditor.form:101 FEditor.form:313 FForm.form:403 #: FIconEditor.form:72 FImageEditor.form:54 FMenu.class:64 -#: FTextEditor.form:219 +#: FTextEditor.form:227 msgid "Save" msgstr "" #: FConnectionEditor.form:109 FEditor.form:307 FForm.form:397 #: FHelpBrowser.form:67 FIconEditor.form:79 FImageEditor.form:62 -#: FTextEditor.form:213 FTranslate.class:730 +#: FTextEditor.form:221 FTranslate.class:730 msgid "Reload" msgstr "" @@ -1301,7 +1301,7 @@ msgstr "" msgid "Go to" msgstr "" -#: FEditor.form:99 FTextEditor.form:67 +#: FEditor.form:99 FTextEditor.form:68 msgid "Go to line..." msgstr "" @@ -1317,15 +1317,15 @@ msgstr "" msgid "&Startup class" msgstr "" -#: FEditor.form:167 FTextEditor.form:117 +#: FEditor.form:167 FTextEditor.form:125 msgid "Select &All" msgstr "" -#: FEditor.form:176 FOutput.form:89 FTextEditor.form:126 +#: FEditor.form:176 FOutput.form:89 FTextEditor.form:134 msgid "Find next" msgstr "" -#: FEditor.form:183 FOutput.form:96 FTextEditor.form:133 +#: FEditor.form:183 FOutput.form:96 FTextEditor.form:141 msgid "Find previous" msgstr "" @@ -1341,15 +1341,15 @@ msgstr "" msgid "&Watch expression" msgstr "" -#: FEditor.form:214 FTextEditor.form:142 +#: FEditor.form:214 FTextEditor.form:150 msgid "Advanced" msgstr "" -#: FEditor.form:218 FTextEditor.form:153 +#: FEditor.form:218 FTextEditor.form:161 msgid "Lower case" msgstr "" -#: FEditor.form:225 FTextEditor.form:146 +#: FEditor.form:225 FTextEditor.form:154 msgid "Upper case" msgstr "" @@ -1365,7 +1365,7 @@ msgstr "" msgid "Paste special..." msgstr "" -#: FEditor.form:259 FTextEditor.form:163 +#: FEditor.form:259 FTextEditor.form:171 msgid "Insert color..." msgstr "" @@ -1377,19 +1377,19 @@ msgstr "" msgid "Sort procedures..." msgstr "" -#: FEditor.form:277 FTextEditor.form:183 +#: FEditor.form:277 FTextEditor.form:191 msgid "View" msgstr "" -#: FEditor.form:281 FTextEditor.form:187 +#: FEditor.form:281 FTextEditor.form:195 msgid "No split" msgstr "" -#: FEditor.form:288 FTextEditor.form:194 +#: FEditor.form:288 FTextEditor.form:202 msgid "Horizontal split" msgstr "" -#: FEditor.form:295 FTextEditor.form:201 +#: FEditor.form:295 FTextEditor.form:209 msgid "Vertical split" msgstr "" @@ -1429,7 +1429,7 @@ msgstr "" msgid "Procedure list" msgstr "" -#: FEditor.class:2366 FIconEditor.class:2048 FTextEditor.class:496 +#: FEditor.class:2366 FIconEditor.class:2048 FTextEditor.class:498 msgid "" "The file has been modified.\n" "\n" @@ -1543,7 +1543,7 @@ msgstr "" msgid "Change into" msgstr "" -#: FForm.form:136 +#: FForm.form:136 FTextEditor.form:74 msgid "Open code" msgstr "" @@ -1659,7 +1659,7 @@ msgstr "" msgid "Menu editor..." msgstr "" -#: FForm.form:435 FTextEditor.form:251 +#: FForm.form:435 FTextEditor.form:259 msgid "Code" msgstr "" @@ -1892,7 +1892,7 @@ msgid "" "Do you want to save it ?" msgstr "" -#: FImageEditor.form:48 FTextEditor.form:229 +#: FImageEditor.form:48 FTextEditor.form:237 msgid "Text editor" msgstr "" @@ -4015,23 +4015,23 @@ msgstr "" msgid "Use a fixed font" msgstr "" -#: FTextEditor.form:169 +#: FTextEditor.form:177 msgid "Compress file" msgstr "" -#: FTextEditor.form:175 +#: FTextEditor.form:183 msgid "Uncompress file" msgstr "" -#: FTextEditor.class:691 +#: FTextEditor.class:693 msgid "The file has been compressed from &1 to &2 bytes (&3)." msgstr "" -#: FTextEditor.class:691 +#: FTextEditor.class:693 msgid "Original file has been saved in the Project folder." msgstr "" -#: FTextEditor.class:697 +#: FTextEditor.class:699 msgid "Unable to compress file." msgstr "" diff --git a/app/src/gambas3/.src/Component/CComponent.class b/app/src/gambas3/.src/Component/CComponent.class index 18e7f11fd..b06b4a1a2 100644 --- a/app/src/gambas3/.src/Component/CComponent.class +++ b/app/src/gambas3/.src/Component/CComponent.class @@ -1174,7 +1174,7 @@ Static Public Function GetClassSymbols(sClass As String) As Collection For Each sFamily In CFamily.List sPath = Project.FindPath(sClass & "." & sFamily) If Exist(sPath) Then - hPForm = Project.LoadFile(sPath) + Try hPForm = Project.LoadFile(sPath) Break Endif Next diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.class b/app/src/gambas3/.src/Editor/Code/FEditor.class index b23b38b4a..60cf4b957 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FEditor.class @@ -3111,7 +3111,7 @@ End Public Sub panToolBar_Configure() If $sModule Then - btnForm.Picture = Picture["img/16/" & $sModule & ".png"] + Action[".show-form"].Picture = Picture["img/16/" & $sModule & ".png"] btnForm.ToolTip = CModule[$sModule].Name btnForm.Show Else @@ -3356,6 +3356,7 @@ Public Sub mnuPretty_Click() Y = Editor.Line Editor.Begin If Not bSelected Then Editor.SelectAll + Print Editor.Selection.Text Editor.Insert(sNewText) Editor.Goto(Y, X) Editor.End diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.form b/app/src/gambas3/.src/Editor/Code/FEditor.form index c29c73bb6..812e82166 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.form +++ b/app/src/gambas3/.src/Editor/Code/FEditor.form @@ -21,7 +21,7 @@ Shortcut = "F2" } { mnuForm Menu - Action = ".code-form" + Action = ".show-form" Text = ("Open form") Picture = Picture["img/16/form.png"] Shortcut = "F12" @@ -458,11 +458,6 @@ Shortcut = "F9" Picture = "icon:/small/halt" } - { Action code-form - Text = "Open form" - Shortcut = "F12" - Picture = "img/16/form.png" - } { Action color Text = "Insert color..." Shortcut = "" @@ -560,7 +555,8 @@ Shortcut = "Ctrl+A" } { Action show-form - Text = "Form" + Text = "Open form" + Shortcut = "F12" Picture = "img/16/form.png" } { Action startup-class diff --git a/app/src/gambas3/.src/Editor/Other/FTextEditor.class b/app/src/gambas3/.src/Editor/Other/FTextEditor.class index 07d6ff53f..85ff6c87f 100644 --- a/app/src/gambas3/.src/Editor/Other/FTextEditor.class +++ b/app/src/gambas3/.src/Editor/Other/FTextEditor.class @@ -47,9 +47,11 @@ Public Sub _new(sPath As String, Optional bModule As Boolean) If bModule Then btnShowCode.Visible = True + mnuShowCode.Show Me.Name = File.BaseName(Path) Else btnShowCode.Visible = False + mnuShowCode.Hide Me.Name = File.Name(Path) Endif diff --git a/app/src/gambas3/.src/Editor/Other/FTextEditor.form b/app/src/gambas3/.src/Editor/Other/FTextEditor.form index 2c6e1b604..88d4d893e 100644 --- a/app/src/gambas3/.src/Editor/Other/FTextEditor.form +++ b/app/src/gambas3/.src/Editor/Other/FTextEditor.form @@ -12,6 +12,12 @@ Text = ("Go to line...") Shortcut = "Ctrl+G" } + { mnuShowCode Menu + Action = ".show-code" + Text = ("Open code") + Picture = Picture["img/16/class.png"] + Shortcut = "F12" + } { Menu3 Menu } { mnuUndo Menu @@ -358,6 +364,11 @@ Text = "Code" Picture = "img/16/class.png" } + { Action show-code + Text = "Open code" + Shortcut = "F12" + Picture = "img/16/class.png" + } { Action ucase Text = "Upper case" Shortcut = "Ctrl+Shift+U" diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index 1277f10df..0277026a7 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -2067,7 +2067,7 @@ Private Sub CompileError(sMsg As String) sErr = TranslateMessage(sMsg) - If hForm And If iLine >= hForm.Editor.Lines.Count Then + If hForm And If iLine > hForm.Editor.Lines.Count Then SetMessage(File.BaseName(sFile) & ": " & sErr & " " & ("in form definition")) sMsg = "" & sErr & " " & ("in form definition") Else If iLine >= 1 Then diff --git a/comp/src/gb.web/.src/WebPage.class b/comp/src/gb.web/.src/WebPage.class index 90dcef956..28cfcab21 100644 --- a/comp/src/gb.web/.src/WebPage.class +++ b/comp/src/gb.web/.src/WebPage.class @@ -5,7 +5,11 @@ Create Static Static Public Sub Main() - + Dim hObject As Object + + hObject = Application.Startup.AutoCreate() + If Not hObject Is WebPage Then Return + hObject.Render End diff --git a/comp/src/gb.web/.src/Webpage1.class b/comp/src/gb.web/.src/Webpage1.class index 0a5fa73ac..6cc783315 100644 --- a/comp/src/gb.web/.src/Webpage1.class +++ b/comp/src/gb.web/.src/Webpage1.class @@ -1,2 +1,3 @@ ' Gambas class file + diff --git a/comp/src/gb.web/.src/Webpage1.webpage b/comp/src/gb.web/.src/Webpage1.webpage index 69aadd204..6ebfc540d 100644 --- a/comp/src/gb.web/.src/Webpage1.webpage +++ b/comp/src/gb.web/.src/Webpage1.webpage @@ -1,6 +1,6 @@ - - -

<%= Application.Name %>

+<%[Header]%> ==> OtherWebPage.Render + +

<%=Application.Name%>

<% Print "

Gambas

"; @@ -9,5 +9,4 @@ For i = 1 To 10 Next %> - - +<%[Footer]%> diff --git a/main/gbc/gbc.c b/main/gbc/gbc.c index d38eeed7c..668028799 100644 --- a/main/gbc/gbc.c +++ b/main/gbc/gbc.c @@ -286,7 +286,19 @@ static void compile_file(const char *file) { JOB->first_line = FORM_FIRST_LINE; BUFFER_add(&JOB->source, "#Line " FORM_FIRST_LINE_STRING "\n", -1); - FORM_do(main_public); + + switch (JOB->family->type) + { + case FORM_WEBPAGE: + fprintf(stderr, "gbc: warning: WebPage not implemented yet\n"); + break; + + case FORM_NORMAL: + default: + FORM_do(main_public); + break; + } + BUFFER_add(&JOB->source, "#Line 1\n", -1); } diff --git a/main/gbc/gbc_compile.c b/main/gbc/gbc_compile.c index 8653cf70a..7eba71971 100644 --- a/main/gbc/gbc_compile.c +++ b/main/gbc/gbc_compile.c @@ -63,8 +63,13 @@ static char *COMP_classes = NULL; COMPILE COMP_current; -const char *COMP_form_families[] = { "form", "report", NULL }; -bool COMP_family_allowed[2] = { FALSE, FALSE }; +const FORM_FAMILY COMP_form_families[] = +{ + { "form", FORM_NORMAL }, + { "report", FORM_NORMAL }, + { "webpage", FORM_WEBPAGE }, + { NULL } +}; static bool read_line(FILE *f, char *dir, int max) { @@ -319,7 +324,7 @@ void COMPILE_begin(const char *file, bool trans) CLEAR(JOB); JOB->name = STR_copy(file); - JOB->form = FORM_get_file(JOB->name); + JOB->form = FORM_get_file_family(JOB->name, &JOB->family); JOB->output = OUTPUT_get_file(JOB->name); if (trans) diff --git a/main/gbc/gbc_compile.h b/main/gbc/gbc_compile.h index 204004c31..2ef0253e8 100644 --- a/main/gbc/gbc_compile.h +++ b/main/gbc/gbc_compile.h @@ -34,6 +34,7 @@ #include "gb_limit.h" #include "gb_reserved.h" #include "gbc_read.h" +#include "gbc_form.h" #include "gbc_class.h" @@ -66,6 +67,7 @@ typedef FUNCTION *func; /* current function being compiled */ CLASS *class; /* current class being compiled */ char *form; /* form file name */ + const FORM_FAMILY *family; /* form file family */ char *tname; /* translation file name */ int default_library; /* default library name for extern declarations */ } @@ -78,8 +80,8 @@ EXTERN char *COMP_root; EXTERN char *COMP_project; EXTERN char *COMP_project_name; EXTERN char *COMP_info_path; -EXTERN const char *COMP_form_families[]; -EXTERN bool COMP_family_allowed[]; +EXTERN FORM_FAMILY COMP_form_families[]; +//EXTERN bool COMP_family_allowed[]; #endif diff --git a/main/gbc/gbc_form.c b/main/gbc/gbc_form.c index 3026570a5..f6b267dd2 100644 --- a/main/gbc/gbc_form.c +++ b/main/gbc/gbc_form.c @@ -277,19 +277,19 @@ static void save_action(bool delete) STR_free(name); } -char *FORM_get_file(const char *file) +char *FORM_get_file_family(const char *file, const FORM_FAMILY **family) { char *form; - const char **p; + const FORM_FAMILY *p; if (strcmp(FILE_get_ext(file), "class")) return NULL; p = COMP_form_families; - while (*p) + while (p->ext) { - form = STR_copy(FILE_set_ext(file, *p)); + form = STR_copy(FILE_set_ext(file, p->ext)); if (FILE_exist(form)) break; STR_free(form); @@ -297,6 +297,7 @@ char *FORM_get_file(const char *file) p++; } + if (form) *family= p; return form; } diff --git a/main/gbc/gbc_form.h b/main/gbc/gbc_form.h index 9945d6d63..763692f8a 100644 --- a/main/gbc/gbc_form.h +++ b/main/gbc/gbc_form.h @@ -24,6 +24,18 @@ #ifndef __GBC_FORM_H #define __GBC_FORM_H +enum { + FORM_NORMAL = 0, + FORM_WEBPAGE = 1 +}; + +typedef + struct { + char *ext; + int type; + } + FORM_FAMILY; + typedef struct { char *name; @@ -35,6 +47,6 @@ typedef #define FORM_FIRST_LINE_STRING "100000" void FORM_do(bool ctrl_public); -char *FORM_get_file(const char *file); +char *FORM_get_file_family(const char *file, const FORM_FAMILY **family); #endif diff --git a/main/gbc/gbc_header.c b/main/gbc/gbc_header.c index 939492f92..af1eea95e 100644 --- a/main/gbc/gbc_header.c +++ b/main/gbc/gbc_header.c @@ -203,7 +203,7 @@ static void analyze_function_desc(TRANS_FUNC *func, int flag) static void header_module_type(void) { const char *ext; - const char **p; + const FORM_FAMILY *p; /*JOB->class->name = STR_copy(FILE_get_name(JOB->name));*/ @@ -222,9 +222,9 @@ static void header_module_type(void) else { p = COMP_form_families; - while (*p) + while (p->ext) { - if (strcasecmp(ext, *p) == 0) + if (strcasecmp(ext, p->ext) == 0) { JOB->is_module = FALSE; JOB->is_form = TRUE; @@ -233,7 +233,7 @@ static void header_module_type(void) p++; } - if (!*p) + if (!p->ext) THROW("Unknown file extension"); }