New editor version for testing

Started by tzachs, Sun 08/07/2012 22:43:48

Previous topic - Next topic

tzachs

Please backup your game before using this version!!!!!!!!



Edit: replaced with a new version that also fixes the bug described here

Edit 2: replaced with a newer version that fixes a bug and implements a few suggestions, both described here

Edit 3: replaced with a newer version that fixes a crash when clicking "go to definition", described here

Edit 4 (18/7/12): More fixes described here!

Edit 5 (20/7/12): More fixes described here!

Edit 6 (21/7/12): More fixes & improvements described here!

Edit 7 (22/7/12): Fixed the crash described here!

Edit 8 (29/7/12): Committed the changes to the 3.2.2 branch.

Hi, I've added a few features for the editor.
Please test and/or provide feedback.
Once I see everything is well I'll commit to 3.2.2 development branch.

The features:

Folders:
Added folders for characrers, dialogs, inventory items, guis, rooms, scripts and views.
Added new menu items for all folders to move up/down,
and the ability to drag/drop files to be before other files.

For scripts:
- Script and header files are now combined into one and can be expanded/collapsed, similar to room settings & script.
- I removed the ability to move files up/down, this can now be done with normal drag/drop (and not only for scripts).
- Also removed the "exclude script" option, it made things a mess and I couldn't understand why it is needed.
If anybody knows, please tell me.
- The order of the scripts (for script dependencies) is the same as it was before, a script can use all the scripts
above it.

For rooms:
- The "Sort room by number" now sorts within folders. I actually don't understand why this feature is needed, if anyone
knows please tell me.


Find all usages:
Added a menu item to find all usages for characters, dialogs, views, inventory items and global variables.
It won't actually find scripts that use the character id (or dialog/view id), just scripts that use the actual
script name of that specific object.


An example of the folders and the "Find all usages" menu item

Navigate (in tree):
Added a menu item for almost all document tabs, to navigate to their node on the project tree
(can be useful for large projects).


An example of the "Navigate" feature.

Goto Line:
In script editor, pressing Ctrl+G will now open the "Goto line" dialog, you can select a line number and the
editor will jump to that line. Since "Ctrl+G" was already used as a shortcut to open the global script,
I replaced that shortcut with Ctrl+Shift+G (and also replaced the shortcut to open the global header
from Ctrl+H to Ctrl+Shift+H for consistency).


An example of the "Goto Line" feature

Mono:
I've refactored some code to make it more Mono-compatible, so that it could run properly when compiled with Mono
(cross platform implementation of .Net).
There's still a lot more work to be done (even without mentioning the native dll), but it's at least a step
in the right direction.

The changes I've done-

  • I replaced in tons of places the hard-coded "\" used as a directory separator with the directory separator of the OS,
    so that it'll also work on Linux machines.
  • I switched the code that detects Shift & Ctrl keyboard presses with a managed solution, that should be supported
    by MONO- this is used when selecting colors in the palette, for example.
  • I switched the code that detects when the Room Designer is focused (used when pressing the up/down arrows to pan
    the working area) to a managed solution, that should be supported by MONO.
  • I switched the code that copies arrays in memory to a managed solution (used when loading a sprite from file).
  • I partially disabled some features only when running with Mono, since I couldn't see a way to code them without the
    Win API:
       - Breaking in debug will not automatically set the editor to the foreground, the user might have to click on the window
       - Notifying the user on file changes externally if the editor is in focus will not happen. It will happen when
         the window is activated, so I hope it won't be too annoying.

Ryan Timothy B

Sounds like a lot of good contributions.

Speaking of the "Find all usages", would it be possible to use your code to also have a "Refactor > Rename" ability? Where it actually changes all instances in script of that old object name to the new name.

Crimson Wizard

Looks really good.

Quote from: tzachs on Sun 08/07/2012 22:43:48
For rooms:
- The "Sort room by number" now sorts within folders. I actually don't understand why this feature is needed, if anyone
knows please tell me.
"Sort room by number" is useful if you added rooms with lower number after rooms with higher number. But with folders it will be obviously easier to group them. Actually I hope one day it will be possible to reference rooms by script name, rather than number.

Ryan Timothy B

In all honesty everything should be accessible via script names. Completely eliminating the hard-coded numbering.

tzachs

Quote from: Ryan Timothy on Sun 08/07/2012 23:32:55
Speaking of the "Find all usages", would it be possible to use your code to also have a "Refactor > Rename" ability? Where it actually changes all instances in script of that old object name to the new name.
Yes, this could be done. Feel free to add an issue to the new tracker...
I'm a bit concerned though, since the current implementation of "Find All Usages" is not as sophisticated as it should be and might cause undesired behaviors in some edge cases, so we probably should add a preview window that shows all changes with a check box list so you'd be able to uncheck unwanted changes.

Quote from: Crimson Wizard on Mon 09/07/2012 00:47:12
"Sort room by number" is useful if you added rooms with lower number after rooms with higher number. But with folders it will be obviously easier to group them.
Ahh, thanks, I forgot about being able to create rooms with high numbers..

Snarky

Quote from: tzachs on Sun 08/07/2012 22:43:48
- Also removed the "exclude script" option, it made things a mess and I couldn't understand why it is needed.
If anybody knows, please tell me.

Wow, excellent work Tzachs!

I haven't used the exclude script option much in current AGS, but I can see it being very useful if (as I hope) the editor moves away from importing all resources into the project file, and instead just stores them as pointers to individual files that are kept in folders in the file system, like in most IDEs. Then you might often want to exclude a file from the project while keeping it in the folder (for example something you're working on that isn't ready yet, or the source files for the graphics).

Calin Leafshade

AGS has a cascading input catching system that is almost never used (dunno why, its awesome)

So, lets assume you have an android version of your game and a mouse based version.

You could have the android touch script higher in the list and when on_mouse_click() gets run you can catch the input (ClaimEvent()) and not let it progress down the scripts.

Now when you want to release your mouse version you can just exclude the android script from the project and the input will just pass through to the mouse script below.

Granted, the same behaviour can be handled with an if/else statement or a #define but why should it if you can keep the two pieces of code entirely separate.

tzachs

Well, what both of you are saying would make sense if that feature was implemented in the same way it's implemented in visual studio, for example, where an excluded project is greyed out and not compiled, but you can always load it back in with a right click->reload...

But in AGS, the script is actually removed from the tree. As it is, I don't see it as useful at all, and if you really want it just copy the script file to a safe place and then delete the script, it's the same thing.
Maybe in the future we can implement it by greying it out and just not sending it to compile, shouldn't be too hard to do...

Hmmm, actually, I've just looked at the code again, and the feature was for rooms, not for scripts, which makes it even less useful, I think (unless someone will correct me).

Crimson Wizard

Quote from: Calin Leafshade on Mon 09/07/2012 10:45:02
AGS has a cascading input catching system that is almost never used (dunno why, its awesome)
Hah! Something I never knew about. I usually used straight opposite way to handle mouse click: called something like MyScript::OnMouseClick from global script.

xenogia

I'm glad your making it more MONO friendly.  This gives me hopes for a better linux build.

steptoe

Hi

shame you never included a template.

Will put one in to try later.


8-)

It's not over until the fat lady sings..

Crimson Wizard

Quote from: steptoe on Tue 10/07/2012 22:09:39
Hi

shame you never included a template.

Will put one in to try later.


8-)



By the way, is it possible to make "Empty Game" template built-in?

tzachs

Yes, when we'll incorporate NAnt or some other build tool, we'll be able to control what goes where and can copy the template on a post build event.
This will also come in handy for doing automatic daily builds and neat stuff like that.

On another note, I've replaced the version on the first post with a new one that also fixes the bug described here.

JJS

I have a bug:

Create a folder in "Inventory items". Double-click on the empty folder. It will give you an error message:

Code: text

Error: Die Eingabezeichenfolge hat das falsche Format.
Version: AGS 3.2.2.112

System.FormatException: Die Eingabezeichenfolge hat das falsche Format.
   bei System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   bei System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   bei System.Convert.ToInt32(String value)
   bei AGS.Editor.Components.InventoryComponent.ItemCommandClick(String controlID)
   bei AGS.Editor.Components.BaseComponentWithFolders`2.CommandClick(String controlID)
   bei AGS.Editor.ProjectTree.ProcessClickOnNode(String nodeID, MouseButtons button)
   bei AGS.Editor.ProjectTree.projectTree_NodeMouseDoubleClick(Object sender, TreeNodeMouseClickEventArgs e)
   bei System.Windows.Forms.TreeView.OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e)
   bei System.Windows.Forms.TreeView.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



Also a suggestion:

If you drag an item, I would expect the folder under the item to get highlighted if the item can be dropped there. Right now the first item that the mouse is dragged over gets highlighted and after that there is no feedback. It would be extra sweet if folders with subfolders would automatically expand when hovering over them while dragging so that the item can be dropped into a subfolder.
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

Shane 'ProgZmax' Stevens

Quote
Added folders for characrers, dialogs, inventory items, guis, rooms, scripts and views.
Added new menu items for all folders to move up/down,
and the ability to drag/drop files to be before other files.

Well, that's pretty much all the editor improvements I had wanted to make but never got around to so thanks for that!

tzachs

Thanks guys!

JJS, nice catch on the bug.
I updated the version on the first post with a fix.

I also implemented both your suggestions: hovered nodes during dragging will be highlighted with a light gray, and a folder will be expanded during a drag if you hover over it for more than 0.5 seconds.
Let me know if that's what you had in mind.

Crimson Wizard

#16
I have a question regarding "Windows" menu.

If I have several pages open, for example a number of "Fonts", and I choose a page in "Windows", the order of pages in the menu will be resorted so that the selected one is always the first. Is it how it is supposed to be?

EDIT: Also, perhaps you will be able to implement this: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45623.msg624000#msg624000

Joseph DiPerla

Nicely done Tzachs! Really like the changes you have done.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

JJS

Quote from: tzachs on Thu 12/07/2012 19:14:54Let me know if that's what you had in mind.
Nice! It works exactly as I had envisioned.

A couple more things:

When right-clicking a function/variable and selecting "Go to definition" I get this error message:

Code: text
Error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Version: AGS 3.2.2.112

System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei AGS.Editor.ScriptEditor.GoToDefinition(String structName, String memberName)
   bei AGS.Editor.ScriptEditor.ContextMenuChooseOption(Object sender, EventArgs e)
   bei System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   bei System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   bei System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   bei System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   bei System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   bei System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   bei System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   bei System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   bei System.Windows.Forms.ToolStrip.WndProc(Message& m)
   bei System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



Also I must admit that I haven't worked with the Editor in a long time, but I found these things about the translation system a bit weird:
- When you don't rename the translation from "New translation" you don't get the prompt to initialize the translation file and it stays just empty. I found this pretty irritating as I didn't care what it was named and just wanted to quickly test it out.
- When double-clicking a translation file, there is a message box that tells you to open the file externally. I think it should either give the option to open the file directly with the standard text editor ("AGS cannot open this file directly. Do you want to display it in the standard text editor instead? YES/NO") or the file should be displayed as a text file in the AGS editor. This should be possible as there is already a text editor for the scripts.

Well, I should probably have created issues tracker entries about these as they are not really related to this version...
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

tzachs

I put up a new version in the first post that fixes the crash when clicking on "go to definition", and also saw that using it on a global variable didn't do anything so I fixed that too (it will now open the global variables pane and select the variable).
I didn't implement any of the other suggested features, sorry guys!

Quote from: Crimson Wizard on Thu 12/07/2012 20:59:29
I have a question regarding "Windows" menu.

If I have several pages open, for example a number of "Fonts", and I choose a page in "Windows", the order of pages in the menu will be resorted so that the selected one is always the first. Is it how it is supposed to be?
That's a rather philosophical question, isn't it?  ;)
Actually, I didn't even think about it when I implemented it, it was definitely not intentional, I just implemented it in the easiest way I could think of...
But now that you mentioned it, I took a look at Visual Studio 2008 to see how it's implemented there, and it's exactly the same!
So I'll claim it's a feature, and unless it really bothers people, I see no reason to change it.

SMF spam blocked by CleanTalk