The first one looked like this:
I only have the screenshot from Glade with it, since I didn't actually got to import it. Besides the fact that I didn't aligned the entries (which could of been fixed), the main problem was that I had a notebook there and the UI was getting a bit heavy. The plan was to focus on one of the first 2 tabs depending on what you had selected (a group or a snippet) in the Snippets Browser which was attached. The 3rd one was there to edit global variables of course (which are now called "Anjuta variables").
In the second one, I gave up on the notebook (not to mention that I aligned the entries):
Now, the third and current version looks like this:
There isn't a frame anymore around the editor, things were moved around a bit and I think I have proper padding and sizing for the items in the editor. As a note, the content shown there is in preview mode - the preview button is a toggle one and while in preview mode, the variables are evaluated and the text view isn't editable. As another note, the GtkTextView will be changed with a GtkSourceView when I will finish with some more important stuff. There will be a highlighting scheme for the snippet (so it will highlight variables) and while in preview mode it will show the resulting content with the highlighting scheme of one of the languages supported by the snippet.
The combo box for the languages has 2 cell renderers: a checkbox and a text one - the language, so it will let you choose one or more languages for which the snippet is meant.
The variables tree view on the right is there for a better management of variables and to avoid some frustrating moments. By the last thing I refer to the following situation: let's say a user has in the content of the snippet the text ${some_text}, which would mean a variable with the current syntax. If I wouldn't hold references to the variables which are used, I couldn't have a way to detect what the user meant with that string (though in 99% of the cases it would be a variable, but still ... you never know). Right now, if I don't find a reference to the variable "some_text" then I will just print out the string ${some_text} when evaluating the snippet. As a matter of fact, if "var" is a referenced snippet variable and it has it's default value "default", then "${some ${var} text}" will get evaluated to "${some default text}".
Will also explain briefly the variables tree view there. A more detailed screenshot:
The variables which are in bold are the ones for which the snippet holds references, so if the string "${var_name}" will appear in the content, it must appear here on top to be treated as a variable. The other variables which can be seen are Anjuta (global) variables and are there just so the user can have a clear view of them and insert them if needed (inserting one in the content will also add it to the referenced ones).
As you can see, when you edit the name of the variable (just those which are referenced can be edited -- those are the only ones of which the snippet knows), there will also be a combo box entry so you can choose the name of an Anjuta variable easier (well, you can't see the popup because it seems I can't take screenshots if there is a popup). Choosing the name of a variable to an Anjuta one will also mark it as Anjuta in the type column.
Still, if that's not what you meant with the name of the variable (to get the Anjuta one), you can change it back since the column type is editable (it's a combo box with 2 entries: Anjuta and Snippet). But if you change the type of a variable to Anjuta and that variable doesn't exist (like in the screenshot, when I request the "license_file_name" Anjuta variabile, but it seems the database doesn't hold an entry for that), it will show a warning background and icon which has a tooltip to inform the user he should add that variable if he wishes from the Preferences window. I say "if he wishes" because it isn't mandatory for an Anjuta variable to actually exist ... it will still work just fine, but it will get evaluated to the default value.
The last editable column is the "Default Value" one which, obviously, let's you edit the default value. It's important to say that the default value is something that belongs to the snippet context (so Anjuta variables have default values only when they are referenced by a snippet and that default value belongs to the snippet, it's not global). The "Instant Value" column let's you see how that variable would be evaluated at that moment in the snippet context and is not editable.
That's about it. I implemented some other minor features this week, but I don't think I can remember all of them (like tooltips with the snippet evaluated content in the Snippets Browser ... not the full content, but just 200 chars or something like that) and I still have some to implement, but still, most of the important stuff in the editor is done.
Not sure what I will do for next week, but will mention some of the goals, though they won't take me all the week:
- Implement error detection in the editor, like: if the trigger already exists for one of the selected languages a warning icon should appear, if the user hasn't chosen a group for a new snippet or any language should also show an warning icon (these are to be shown next to the 2 combo-boxes). This will not allow the user to save the snippet.
- Show a warning dialog if the user made changes and didn't saved them.
- When changing the name of a variable in the tree view I should also change it in the content.
- Clean up the preferences layout and actually implement some of the stuff there.
0 comments:
Post a Comment