It is currently Sun Mar 07, 2021 11:12 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: EditorFactory - Module for object management in a Canvas
PostPosted: Sat Jan 16, 2021 10:04 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 1403
Location: Germany, Glienicke
Dear all,

together with ShadowStorm I want to present our module for object management in a Canvas Gadget.
This module is related to this original thread: Project Editors Factory...
The module can be used for creating a form editor, game editor, or any kind of object-based editors,
where you want to add, remove, move, resize, attach objects.

The module is not an editor itself, its a module to create an editor in a more easy way, without thinking about the object handling itself.

Key features:
  • Create, delete and attached objects in an initialized canvas gadget.
  • Add drawing callbacks for custom object drawing.
  • Flags like: show, hide, disable, enable, select, unselect for objects.
  • Adding and customizing handles at edges and corners for moving, resizing and adding custom events.
  • Object attachment/container system with multiple frames inside of objects (like panel gadget).
  • Event management for cursor and keyboard events on objects and handles.
  • Definition of object boundaries for position and size.
  • Set and get of "all possible" general object attributes, like: X, Y, width, height, data, cursor, handles, movement/resize steps, selection style.

Download:
EditorFactory.pbi (Version 1.15.00, 2021-01-24)
EditorFactory210124.zip (Archive with include and examples)
A short documentation of each procedure is given in the module part.

The include is shared under the CC BY-NC 4.0 licence.

Feature Requests and Bugs:

    Change Log (1.15.00):
    • Added: SetObjectFrameClipping(), SetObjectFrameOffset()
    • Added: #Object_All, #Object_Default, #Object_Selected as possible constants for various functions.
    • Added: #EventType_Created, #EventType_Freed
    • Change: CanvasObjectsEvent() do not need a specific gadget
    Change Log (1.14.01):
    • Bug-fix: Multiple selection in different frames now disallowed.
    • Bug-Fix: Partially selection works now.

    _________________
    ImageImage


    Last edited by STARGÅTE on Sun Jan 24, 2021 7:32 pm, edited 9 times in total.

    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sat Jan 16, 2021 10:53 pm 
    Offline
    User
    User

    Joined: Sun Oct 09, 2011 7:39 am
    Posts: 47
    Very nice, thanks for sharing!
    This module can become very handy for a future project, I have in mind...


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sat Jan 16, 2021 11:05 pm 
    Offline
    User
    User

    Joined: Tue Feb 14, 2017 12:07 pm
    Posts: 94
    Hello, this module has been under development for some time now.

    Yes, I also think it can be very useful, there are few examples at the moment but we will add more.

    Thanks to you and if you have any questions, don't hesitate :)

    _________________
    I am French, I do not speak English.
    My apologies for the mistakes.


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 12:17 am 
    Offline
    Enthusiast
    Enthusiast
    User avatar

    Joined: Sun Jan 08, 2017 10:27 pm
    Posts: 210
    Location: France
    Thank you for sharing this great module :)
    Now I will try to learn how to use...

    First feedback:
    On Example05_Attachment-and-containers, if I select #Object1 and #Object2 and I move #Object2,
    the moving of #Object2 is done twice, one for the attachment and one for itself.


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 7:03 am 
    Offline
    User
    User

    Joined: Wed Jan 06, 2021 2:53 pm
    Posts: 11
    Thanks to ShadowStorm and STARGÅTE for this useful module. :D
    In my opinion, the most important feature of this module is "Object attachment/container system". I will ask my questions and ambiguities soon.
    Thanks again to the development team.
    With respect.


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 8:51 am 
    Offline
    User
    User

    Joined: Wed Jan 06, 2021 2:53 pm
    Posts: 11
    Why can't we resize the container properly when an object is placed inside the container?

    EditorFactory
    https://i.ibb.co/8Bg8G5y/2.gif


    PB form designer
    https://i.ibb.co/PwdZczK/1.gif


    Last edited by Amitris_de on Tue Jan 26, 2021 12:19 pm, edited 1 time in total.

    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 9:41 am 
    Offline
    Addict
    Addict
    User avatar

    Joined: Thu Jan 10, 2008 1:30 pm
    Posts: 1403
    Location: Germany, Glienicke
    ChrisR wrote:
    On Example05_Attachment-and-containers, if I select #Object1 and #Object2 and I move #Object2,
    the moving of #Object2 is done twice, one for the attachment and one for itself.
    You are right. Normally it should be disallowed to select object in different frames (here object 1 in the main frame and object 2 in the frame of object 1). I will fix it.
    Amitris_de wrote:
    Why can't we resize the container properly when an object is placed inside the container?
    This behavior of EditorFactory is right, because the parent object have to respect the boundary settings of all childs. If the childs should have the opportunity to overlap the frame of the parent, you have to remove the child's boundary. An additional flag has to be implemented, whether the childs should be clipped during drawing.

    _________________
    ImageImage


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 10:16 am 
    Offline
    User
    User

    Joined: Tue Feb 14, 2017 12:07 pm
    Posts: 94
    ChrisR wrote:
    Thank you for sharing this great module :)
    Now I will try to learn how to use...

    First feedback:
    On Example05_Attachment-and-containers, if I select #Object1 and #Object2 and I move #Object2,
    the moving of #Object2 is done twice, one for the attachment and one for itself.

    Hello,
    I couldn't figure out what you meant, but Stargate did :)

    Amitris_de wrote:
    Why can't we resize the container properly when an object is placed inside the container?

    EditorFactory
    Image

    PB form designer
    Image


    Hello Amitris_de,

    Thank you for your videos, they allow you to understand what you mean, good job :)
    And yes, this behavior is normal indeed :)

    It's because of the limits of the objects :)

    _________________
    I am French, I do not speak English.
    My apologies for the mistakes.


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 1:50 pm 
    Offline
    Enthusiast
    Enthusiast
    User avatar

    Joined: Sun Jan 08, 2017 10:27 pm
    Posts: 210
    Location: France
    I started to play a little with it, amazing work :) :D

    I looked at how it could be done for the different containers
    It looks all good for Container Gadget or Canvas_Container Gadget
    Also for the Panel Gadget with the small button (layer_redraw) to represent the tab change
    But I'm wondering how it could be done for a ScrollArea Gadget with an Inner size ? hide, clipp childs when they are outside ?

    Code:
    ; Example06_Containers.pb

    Deleted following EditorFactory update


    Last edited by ChrisR on Wed Jan 27, 2021 10:21 am, edited 3 times in total.

    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 2:07 pm 
    Offline
    Addict
    Addict
    User avatar

    Joined: Thu Jan 10, 2008 1:30 pm
    Posts: 1403
    Location: Germany, Glienicke
    ChrisR wrote:
    But I'm wondering how it could be done for a ScrollArea Gadget with an Inner size ? and hide objects when they are outside ?
    This question is related to Amitris_de's question. As I remember correctly, the #PB_ScrollArea_InnerWidth und #PB_ScrollArea_InnerHeight in ScrollAreaGadget is not a real physically size, it is just to show the right scroll bar length.
    Meaning, you can position your child object wherever you want, independent from this values.
    For EditorFactory this means, you need a function like SetObjectFrameOffset() to change the drawing offset of the inner childs, like the position of scroll bars (which you have to draw by yourself, of course), together with the option to set a clipping frame of drawing of childs at the border of the frame.
    At the moment I'm not sure, if this flag have to define for the parent which contains the childs, or to all childs itself which are in the parent. What do you think?

    Edit: Probably, I make both possible, the parent can define it for all childs, but child can "exclude" itself (by a flag) to be clipped.

    _________________
    ImageImage


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Sun Jan 17, 2021 2:39 pm 
    Offline
    Enthusiast
    Enthusiast
    User avatar

    Joined: Sun Jan 08, 2017 10:27 pm
    Posts: 210
    Location: France
    Great, If you can do both :)
    I think it will be more useful (easy) to define it for the parent.
    with perhaps a flag #Boundary_ParentInnerSize for the chids.

    I would try to support Amitris as well, if my time allows, with its likely EditorFactory engine, could be a beautiful wedding :)


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Mon Jan 18, 2021 9:46 am 
    Offline
    User
    User

    Joined: Wed Jan 06, 2021 2:53 pm
    Posts: 11
    In most designers, we can select objects by dragging a rectangle on a part of the them.

    https://i.ibb.co/ZgcZtfY/38.gif

    but I could not do that in EditorFactory.

    https://i.ibb.co/7RBRtV5/37.gif

    Is there a trick to doing this?


    Last edited by Amitris_de on Tue Jan 26, 2021 12:20 pm, edited 1 time in total.

    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Mon Jan 18, 2021 10:17 am 
    Offline
    Addict
    Addict
    User avatar

    Joined: Thu Jan 10, 2008 1:30 pm
    Posts: 1403
    Location: Germany, Glienicke
    Amitris_de wrote:
    Is there a trick to doing this?
    Yes. If you use SetCursorSelectionStyle() do enable the cursor-frame selection you can use #SelectionStyle_Partially in combination with the other type-flags to enable the partially overlap.
    Code:
    SetCursorSelectionStyle(#Canvas, #SelectionStyle_Solid|#SelectionStyle_Partially, $FF000000, 1.0)

    _________________
    ImageImage


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Mon Jan 18, 2021 11:42 pm 
    Offline
    Addict
    Addict
    User avatar

    Joined: Thu Jan 10, 2008 1:30 pm
    Posts: 1403
    Location: Germany, Glienicke
    Sry Amitris_de, ChrisR just pointed out a bug to me, that the partially selection didn't work.
    I did a quick bug fix. See above the new link.

    _________________
    ImageImage


    Top
     Profile  
    Reply with quote  
     Post subject: Re: EditorFactory - Module for object management in a Canvas
    PostPosted: Tue Jan 19, 2021 8:13 pm 
    Offline
    User
    User

    Joined: Tue Feb 14, 2017 12:07 pm
    Posts: 94
    Hi, I propose a function to know on which canvas (number) an event occurred.

    This can be very useful when creating multiple editors for the event loop.

    - On which canvas did an event occur? > CanvasNumber

    Then we will use CanvasObjectsEvent(CanvasNumber)
    to find out what kind of event (Objects or Handles) happened on it, then after knowing what it was
    use CanvasObjectsEventType(CanvasNumber) to find out what kind of event in question happened on it.

    Code:
    Repeat
     
      NumeroCanvas = CanvasNumberEvent(); On which canvas did something happen?
     
      Select CanvasObjectsEvent(NumeroCanvas) ; Something happened on the NumeroCanvas.
         
        Case #Event_Object ; It is an Object Event.
         
          Select CanvasObjectsEventType(NumeroCanvas) ; What type of Events happened on the Object on the NumeroCanvas ?
             
            Case #EventType_MouseEnter

            ...

    _________________
    I am French, I do not speak English.
    My apologies for the mistakes.


    Top
     Profile  
    Reply with quote  
    Display posts from previous:  Sort by  
    Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4, 5  Next

    All times are UTC + 1 hour


    Who is online

    Users browsing this forum: No registered users and 25 guests


    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum

    Search for:
    Jump to:  

     


    Powered by phpBB © 2008 phpBB Group
    subSilver+ theme by Canver Software, sponsor Sanal Modifiye