Loading ...
Sorry, an error occurred while loading the content.

[PATCH] Graphical sign loading

Expand Messages
  • Vincent Berthoux
    Hello Here is my patch to allow graphical sign loading and displaying in MacVim. I ve tested it under Mac OS 10.6.3 with the CoreText Renderer. I m totally new
    Message 1 of 14 , Jul 16, 2010
    • 0 Attachment
      Hello

      Here is my patch to allow graphical sign loading and displaying in MacVim.
      I've tested it under Mac OS 10.6.3 with the CoreText Renderer. I'm totally new
      to Objective-C memory management, so you may want to check if there is no
      memory leak left.

      The implementation work as follow :
      For each loaded sign in vim, the vim backend convert it as a NSString and
      store it in the vim runtime, and send a message to a gui to load the image.
      The message is rerouted to the textview helper where it is loaded and
      stored in a associative table. The file path is used as the key. Each
      time the sign need to be drawn, the path is sent to the backend with the
      screen coordinates.

      Let me know if you have any suggestions/enhancements.

      Cheers

      Vincent Berthoux

      PS: sorry if there is a double send, I didn't saw my first mail appear anywhere.

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • John Beckett
      ... That s because new members are moderated. There is no way to inform people about this, but messages from new members are put in a queue and held until a
      Message 2 of 14 , Jul 16, 2010
      • 0 Attachment
        Vincent Berthoux wrote:
        > PS: sorry if there is a double send, I didn't saw my first
        > mail appear anywhere.

        That's because new members are moderated. There is no way to
        inform people about this, but messages from new members are put
        in a queue and held until a manager checks them for spam. I
        removed your duplicate message (and deleted three spam messages
        from someone else). Your next message will appear within a few
        minutes with no moderation.

        There is some info here:
        http://groups.google.com/group/vim_use/web/vim-information

        John

        --
        You received this message from the "vim_mac" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • björn
        ... Hi Vincent, Thanks for the patch! I have taken a glance at the patch but not tried it out yet. Overall it looks good, I will take a proper look at it
        Message 3 of 14 , Jul 17, 2010
        • 0 Attachment
          On 17 July 2010 00:32, Vincent Berthoux wrote:
          >
          >  Here is my patch to allow graphical sign loading and displaying in MacVim.
          > I've tested it under Mac OS 10.6.3 with the CoreText Renderer. I'm totally new
          > to Objective-C memory management, so you may want to check if there is no
          > memory leak left.
          >
          >  The implementation work as follow :
          > For each loaded sign in vim, the vim backend convert it as a NSString and
          > store it in the vim runtime, and send a message to a gui to load the image.
          > The message is rerouted to the textview helper where it is loaded and
          > stored in a associative table. The file path is used as the key. Each
          > time the sign need to be drawn, the path is sent to the backend with the
          > screen coordinates.
          >
          >  Let me know if you have any suggestions/enhancements.

          Hi Vincent,

          Thanks for the patch! I have taken a glance at the patch but not
          tried it out yet. Overall it looks good, I will take a proper look at
          it once you've addressed a few points (some serious, many not so
          much). Eventually I will merge this.

          Here are my first impressions (in no specific order):

          - You have to read up on Cocoa memory management ([1] in particular):
          e.g. init... methods give you objects that need to be released,
          container classes retain objects that you add to them. I've noticed a
          few spurious retain messages in the patch that should not be there.

          - Whitespace issues: There are a few blank lines delete here and
          there, some blank lines added. Please get rid of these. Also, please
          format your code more like the MacVim code ("if ( blah )" should be
          "if (blah)" etc.).

          - The method [MMBackend sendUTF8String] is confusing, just add to the
          draw queue directly

          - In [MMTextViewHelper drawImage:cellSize:insetSize:frame] you should
          not pass all those extra parameters. Use the
          rectForRow:column:numRows:numColumns (I think) instead. Some text
          views are flipped, others are not so it is not safe to convert
          (row,column) to coordinates in the helper "manually". Also, although
          this means repeated code, deserialize incoming data in each respective
          text view instead of doing it in the helper (like the other draw
          messages). Also, call the variables "row, col" instead of "x,y" so it
          is obvious what they are.

          - Please test that the code works in both the default and core text
          renderer (the ATSUI renderer you don't have to worry about).

          - "signsImage" should probably be "signImages"

          - The proper return type for "init" is "id" (in the helper class).
          Also, please change the code to follow the same code as the other
          "init" methods.

          - Don't leave things like this in the code:

          // why not calling the one defined as class method
          // on NSString? I don't know, for some reason (maybe
          // some initialisation timing...) calling it was
          // crashing vim when some signs where loaded in a
          // plugin.

          It gives a very bad impression. Figure out what your bug is instead
          and call the method on NSString (probably related to improper
          retain/release use).

          - Don't declare variables at the beginning of a function -- declare
          and initialize variables at the same time (I'm looking at gui_macvim.m
          now). Why are you using the CG functions instead of NSImage by the
          way (should be less code)? What happens if the image is not PNG?

          - Have you checked that all APIs you use are available on 10.4? (I
          haven't checked myself)

          - Don't leave printf statements in the patch


          Thanks once again for the patch,
          Björn


          [1] http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043-BEHDEDDB

          --
          You received this message from the "vim_mac" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Vincent Berthoux
          Hi I ve dug around displaying image in MMTextView, and my naïve version of just drawing the image in the rect didn t work with it. I ve tried to manipulate
          Message 4 of 14 , Jul 19, 2010
          • 0 Attachment
            Hi

            I've dug around displaying image in MMTextView, and my 'naïve' version of just drawing the image in the rect didn't work with it. I've tried to manipulate the NSAttributedString via the putImage method in MMTextStorage (see the patch), And aside from breaking the display, it didn't do any good.

            I've updated the patch to take into account all the others remarks, but I'm stuck for the normal renderer (the experimental renderer works well with graphical signs). If you got any ideas/tips on how to implement it, I'd be happy to hear about it.

            Thanks

            Vincent B.
          • Craig
            Hi, Er, what is a Graphical Sign and what is it used for? :-) TIA -C ... -- You received this message from the vim_mac maillist. Do not top-post! Type your
            Message 5 of 14 , Jul 20, 2010
            • 0 Attachment
              Hi,

              Er, what is a Graphical Sign and what is it used for? :-)

              TIA
              -C

              On 16 July, 23:32, Vincent Berthoux <twins...@...> wrote:
              > Hello
              >
              >   Here is my patch to allow graphical sign loading and displaying in MacVim.
              > I've tested it under Mac OS 10.6.3 with the CoreText Renderer. I'm totally new
              > to Objective-C memory management, so you may want to check if there is no
              > memory leak left.
              >
              >  The implementation work as follow :
              > For each loaded sign in vim, the vim backend convert it as a NSString and
              > store it in the vim runtime, and send a message to a gui to load the image.
              > The message is rerouted to the textview helper where it is loaded and
              > stored in a associative table. The file path is used as the key. Each
              > time the sign need to be drawn, the path is sent to the backend with the
              > screen coordinates.
              >
              >  Let me know if you have any suggestions/enhancements.
              >
              >    Cheers
              >
              >       Vincent Berthoux
              >
              > PS: sorry if there is a double send, I didn't saw my first mail appear anywhere.
              >
              >  Patch-to-add-graphical-signs-to-macVim.patch
              > 27KViewDownload

              --
              You received this message from the "vim_mac" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Vincent Berthoux
              The sign element in vim is column of 2 characters (usually) which can associate any text to a line. The first idea for their inclusion in vim was to allow
              Message 6 of 14 , Jul 20, 2010
              • 0 Attachment
                The sign element in vim is column of 2 characters (usually) which can associate any text to a line. The first idea for their inclusion in vim was to allow debugging, by displaying breakpoint and other things. As the debugging support is left relatively unused, we can use it for other purpose. My main utilization is to display an error & warning marker near the line where there is compilation errors.
                You can see some linked screenshots on the issue : ( http://code.google.com/p/macvim/issues/detail?id=276 ). Without the graphical sign extension, you only get characters in the column, and I really like the fancy icons :]

                Vincent

                Le 20 juil. 2010 à 04:08, Craig a écrit :

                > Hi,
                >
                > Er, what is a Graphical Sign and what is it used for? :-)
                >
                > TIA
                > -C
                >
                > On 16 July, 23:32, Vincent Berthoux <twins...@...> wrote:
                >> Hello
                >>
                >> Here is my patch to allow graphical sign loading and displaying in MacVim.
                >> I've tested it under Mac OS 10.6.3 with the CoreText Renderer. I'm totally new
                >> to Objective-C memory management, so you may want to check if there is no
                >> memory leak left.
                >>
                >> The implementation work as follow :
                >> For each loaded sign in vim, the vim backend convert it as a NSString and
                >> store it in the vim runtime, and send a message to a gui to load the image.
                >> The message is rerouted to the textview helper where it is loaded and
                >> stored in a associative table. The file path is used as the key. Each
                >> time the sign need to be drawn, the path is sent to the backend with the
                >> screen coordinates.
                >>
                >> Let me know if you have any suggestions/enhancements.
                >>
                >> Cheers
                >>
                >> Vincent Berthoux
                >>
                >> PS: sorry if there is a double send, I didn't saw my first mail appear anywhere.
                >>
                >> Patch-to-add-graphical-signs-to-macVim.patch
                >> 27KViewDownload
                >
                > --
                > You received this message from the "vim_mac" maillist.
                > Do not top-post! Type your reply below the text you are replying to.
                > For more information, visit http://www.vim.org/maillist.php

                --
                You received this message from the "vim_mac" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Craig
                Thanks for the explanation and the screenshots. -C ... -- You received this message from the vim_mac maillist. Do not top-post! Type your reply below the
                Message 7 of 14 , Jul 20, 2010
                • 0 Attachment
                  Thanks for the explanation and the screenshots.

                  -C

                  On 20 July, 13:41, Vincent Berthoux <twins...@...> wrote:
                  > The sign element in vim is column of 2 characters (usually) which can associate any text to a line. The first idea for their inclusion in vim was to allow debugging, by displaying breakpoint and other things. As the debugging support is left relatively unused, we can use it for other purpose. My main utilization is to display an error & warning marker near the line where there is compilation errors.
                  > You can see some linked screenshots on the issue : (http://code.google.com/p/macvim/issues/detail?id=276). Without the graphical sign extension, you only get characters in the column, and I really like the fancy icons :]
                  >
                  >     Vincent
                  >
                  > Le 20 juil. 2010 à 04:08, Craig a écrit :
                  >
                  >
                  >
                  > > Hi,
                  >
                  > > Er, what is a Graphical Sign and what is it used for? :-)
                  >
                  > > TIA
                  > > -C
                  >
                  > > On 16 July, 23:32, Vincent Berthoux <twins...@...> wrote:
                  > >> Hello
                  >
                  > >>   Here is my patch to allow graphical sign loading and displaying in MacVim.
                  > >> I've tested it under Mac OS 10.6.3 with the CoreText Renderer. I'm totally new
                  > >> to Objective-C memory management, so you may want to check if there is no
                  > >> memory leak left.
                  >
                  > >>  The implementation work as follow :
                  > >> For each loaded sign in vim, the vim backend convert it as a NSString and
                  > >> store it in the vim runtime, and send a message to a gui to load the image.
                  > >> The message is rerouted to the textview helper where it is loaded and
                  > >> stored in a associative table. The file path is used as the key. Each
                  > >> time the sign need to be drawn, the path is sent to the backend with the
                  > >> screen coordinates.
                  >
                  > >>  Let me know if you have any suggestions/enhancements.
                  >
                  > >>    Cheers
                  >
                  > >>       Vincent Berthoux
                  >
                  > >> PS: sorry if there is a double send, I didn't saw my first mail appear anywhere.
                  >
                  > >>  Patch-to-add-graphical-signs-to-macVim.patch
                  > >> 27KViewDownload
                  >
                  > > --
                  > > You received this message from the "vim_mac" maillist.
                  > > Do not top-post! Type your reply below the text you are replying to.
                  > > For more information, visithttp://www.vim.org/maillist.php

                  --
                  You received this message from the "vim_mac" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • Vincent Berthoux
                  Hi, This is my new patch version, I ve removed image from ATSUI & TexView. To avoid regression I now send sign text to the renderer in the case it cannot
                  Message 8 of 14 , Jul 22, 2010
                  • 0 Attachment
                    Hi,
                    This is my new patch version, I've removed image from ATSUI & TexView. To avoid regression I now send sign text to the renderer in the case it cannot render the image and display text instead. I got some color issue with it, if have an idea on how fix that.

                    I've tried to fix all others issues, please let me know if I missed something

                    Thanks

                    Vincent Berthoux
                  • Vincent Berthoux
                    Hi Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only
                    Message 9 of 14 , Jul 23, 2010
                    • 0 Attachment
                      Hi

                      Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only work the the 'experimental' renderer.

                      Thanks

                      Vincent Berthoux
                    • björn
                      ... Thanks again for the patch Vincent -- it is included in the 7.3b BETA I just uploaded. Björn -- You received this message from the vim_mac maillist. Do
                      Message 10 of 14 , Jul 23, 2010
                      • 0 Attachment
                        On 23 July 2010 17:55, Vincent Berthoux wrote:
                        >
                        >   Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only work the the 'experimental' renderer.

                        Thanks again for the patch Vincent -- it is included in the 7.3b BETA
                        I just uploaded.

                        Björn

                        --
                        You received this message from the "vim_mac" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php
                      • Yi Wen
                        sorry for my ignorance. But what does graphical sign loading and displaying mean? What is this about? Thank you ... -- You received this message from the
                        Message 11 of 14 , Jul 23, 2010
                        • 0 Attachment
                          sorry for my ignorance. But what does "graphical sign loading and
                          displaying" mean? What is this about? Thank you

                          On Jul 23, 11:12 am, björn <bjorn.winck...@...> wrote:
                          > On 23 July 2010 17:55, Vincent Berthoux wrote:
                          >
                          >
                          >
                          > >   Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only work the the 'experimental' renderer.
                          >
                          > Thanks again for the patch Vincent -- it is included in the 7.3b BETA
                          > I just uploaded.
                          >
                          > Björn

                          --
                          You received this message from the "vim_mac" maillist.
                          Do not top-post! Type your reply below the text you are replying to.
                          For more information, visit http://www.vim.org/maillist.php
                        • Steven Michalske
                          How can I start using it? Steve ... -- You received this message from the vim_mac maillist. Do not top-post! Type your reply below the text you are replying
                          Message 12 of 14 , Jul 23, 2010
                          • 0 Attachment
                            How can I start using it?

                            Steve

                            On Jul 23, 2010, at 9:12 AM, björn wrote:

                            > On 23 July 2010 17:55, Vincent Berthoux wrote:
                            >>
                            >> Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only work the the 'experimental' renderer.
                            >
                            > Thanks again for the patch Vincent -- it is included in the 7.3b BETA
                            > I just uploaded.
                            >
                            > Björn
                            >
                            > --
                            > You received this message from the "vim_mac" maillist.
                            > Do not top-post! Type your reply below the text you are replying to.
                            > For more information, visit http://www.vim.org/maillist.php

                            --
                            You received this message from the "vim_mac" maillist.
                            Do not top-post! Type your reply below the text you are replying to.
                            For more information, visit http://www.vim.org/maillist.php
                          • Vincent Berthoux
                            Hi To answer both question about graphical sign loading, you can look at the issue I filled originally ( http://code.google.com/p/macvim/issues/detail?id=276 )
                            Message 13 of 14 , Jul 24, 2010
                            • 0 Attachment
                              Hi

                              To answer both question about graphical sign loading, you can look at
                              the issue I filled originally ( http://code.google.com/p/macvim/issues/detail?id=276 )
                              with some screenshots.
                              You can use this extension with all the :sign command (and with the 'icon=' parameter)
                              or you can use some plugins which already use this extension :
                              - cuteErrorMarker : http://www.vim.org/scripts/script.php?script_id=2653
                              mark the lines of your compilation error/warning with an icon

                              - cuteTodoList : a todo list management plugin with icons to show the priority
                              of the tasks.

                              Their must be some other plugins that use this feature, but it's the only one I know
                              (ok and they're my plugins...).

                              Vincent

                              Le 23 juil. 2010 à 14:03, Steven Michalske a écrit :

                              > How can I start using it?
                              >
                              > Steve
                              >
                              > On Jul 23, 2010, at 9:12 AM, björn wrote:
                              >
                              >> On 23 July 2010 17:55, Vincent Berthoux wrote:
                              >>>
                              >>> Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only work the the 'experimental' renderer.
                              >>
                              >> Thanks again for the patch Vincent -- it is included in the 7.3b BETA
                              >> I just uploaded.
                              >>
                              >> Björn
                              >>
                              >> --
                              >> You received this message from the "vim_mac" maillist.
                              >> Do not top-post! Type your reply below the text you are replying to.
                              >> For more information, visit http://www.vim.org/maillist.php
                              >
                              > --
                              > You received this message from the "vim_mac" maillist.
                              > Do not top-post! Type your reply below the text you are replying to.
                              > For more information, visit http://www.vim.org/maillist.php

                              --
                              You received this message from the "vim_mac" maillist.
                              Do not top-post! Type your reply below the text you are replying to.
                              For more information, visit http://www.vim.org/maillist.php
                            • Wy Mitbbs
                              Tried cute todo list, it is pretty. thanks ... -- You received this message from the vim_mac maillist. Do not top-post! Type your reply below the text you
                              Message 14 of 14 , Jul 25, 2010
                              • 0 Attachment
                                Tried cute todo list, it is pretty. thanks

                                On Jul 24, 2010, at 9:09 AM, Vincent Berthoux wrote:

                                > Hi
                                >
                                > To answer both question about graphical sign loading, you can look at
                                > the issue I filled originally ( http://code.google.com/p/macvim/issues/detail?id=276 )
                                > with some screenshots.
                                > You can use this extension with all the :sign command (and with the 'icon=' parameter)
                                > or you can use some plugins which already use this extension :
                                > - cuteErrorMarker : http://www.vim.org/scripts/script.php?script_id=2653
                                > mark the lines of your compilation error/warning with an icon
                                >
                                > - cuteTodoList : a todo list management plugin with icons to show the priority
                                > of the tasks.
                                >
                                > Their must be some other plugins that use this feature, but it's the only one I know
                                > (ok and they're my plugins...).
                                >
                                > Vincent
                                >
                                > Le 23 juil. 2010 à 14:03, Steven Michalske a écrit :
                                >
                                >> How can I start using it?
                                >>
                                >> Steve
                                >>
                                >> On Jul 23, 2010, at 9:12 AM, björn wrote:
                                >>
                                >>> On 23 July 2010 17:55, Vincent Berthoux wrote:
                                >>>>
                                >>>> Here is my final patch version to include graphical signs into macvim. All bugs have been ironed out, and no regression happen. The graphical signs only work the the 'experimental' renderer.
                                >>>
                                >>> Thanks again for the patch Vincent -- it is included in the 7.3b BETA
                                >>> I just uploaded.
                                >>>
                                >>> Björn
                                >>>
                                >>> --
                                >>> You received this message from the "vim_mac" maillist.
                                >>> Do not top-post! Type your reply below the text you are replying to.
                                >>> For more information, visit http://www.vim.org/maillist.php
                                >>
                                >> --
                                >> You received this message from the "vim_mac" maillist.
                                >> Do not top-post! Type your reply below the text you are replying to.
                                >> For more information, visit http://www.vim.org/maillist.php
                                >
                                > --
                                > You received this message from the "vim_mac" maillist.
                                > Do not top-post! Type your reply below the text you are replying to.
                                > For more information, visit http://www.vim.org/maillist.php

                                --
                                You received this message from the "vim_mac" maillist.
                                Do not top-post! Type your reply below the text you are replying to.
                                For more information, visit http://www.vim.org/maillist.php
                              Your message has been successfully submitted and would be delivered to recipients shortly.