Community
    • Login

    [need help] C++ Plugin Template can't figure out how to write a dock dialog

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    8 Posts 4 Posters 307 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ADeA
      ADe
      last edited by

      Hi, I Can’t figure out how to write a dock dialog. or an any kind of dialog/window.

      In notepad++ C++ Plugin Template, I see there’s this DemoDlg example class defined in GoToLineDlg.cpp/GoToLineDlg.h but not used anywhere, and i can’t figure out how to use it on my own.

      here is file: “GoToLineDlg.h”

      #include "DockingDlgInterface.h"
      #include "resource.h"
      
      class DemoDlg : public DockingDlgInterface
      {
      public :
      	DemoDlg() : DockingDlgInterface(IDD_PLUGINGOLINE_DEMO){};
      
          virtual void display(bool toShow = true) const {
              DockingDlgInterface::display(toShow);
              if (toShow)
                  ::SetFocus(::GetDlgItem(_hSelf, ID_GOLINE_EDIT));
          };
      
      	void setParent(HWND parent2set){
      		_hParent = parent2set;
      	};
      
      protected :
      	virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
      
      private :
      
          int getLine() const {
              BOOL isSuccessful;
              int line = ::GetDlgItemInt(_hSelf, ID_GOLINE_EDIT, &isSuccessful, FALSE);
              return (isSuccessful?line:-1);
          };
      
      };
      

      im very comfortable with c++, and i know some basics about win32 api.

      ADeA CoisesC 2 Replies Last reply Reply Quote 0
      • ADeA
        ADe @ADe
        last edited by

        @ADe P.S. if anyone is interested I plan to write a notepad++ ctags plugin for code navigation, so i need a (dockable) dialog interface. yea, i know other n++ ctags plugins exist, but they’re either unmaintained (crashes on newest n++ versions) or buggy or just bad

        1 Reply Last reply Reply Quote 0
        • CoisesC
          Coises @ADe
          last edited by

          @ADe said in [need help] C++ Plugin Template can't figure out how to write a dock dialog:

          I Can’t figure out how to write a dock dialog. or an any kind of dialog/window.

          Sadly, there is, to the best of my knowledge, no official, explicit documentation on how to create a docking dialog. There is an option I can offer.

          I’ve created a Visual Studio template for making a C++ plugin for Notepad++ called NppCppMSVS. I have written fairly detailed documentation.

          Included are examples of modal, non-modal and docking dialogs; settings that can be saved and restored; how to implement menu commands and how to respond to notifications; and the setup to use the C++ interface to Scintilla. It builds a working (though useless) plugin you can modify. However:

          1. This template is not “official”; it isn’t endorsed by the author of Notepad++.

          2. It hasn’t been around that long, so it isn’t exactly “battle tested.” So far, I’ve written one experimental plugin, Controlled Auto-indent, using it. To the best of my knowledge, no one else has used it yet.

          3. It reflects my own coding style and preference, which might not be yours. In some cases, unraveling what I’ve done to use it as an example if you don’t want to do it “my way” could be tedious.

          ADeA 1 Reply Last reply Reply Quote 3
          • ADeA
            ADe @Coises
            last edited by

            @Coises Very good. Looks like actually proper documentation!
            I’ll take a look, thanks for sharing :D

            ThosRTannerT 1 Reply Last reply Reply Quote 0
            • ThosRTannerT
              ThosRTanner @ADe
              last edited by

              @ADe Alternatively, you can have a look at https://github.com/ThosRTanner/Docking_Dialogue_Interface/tree/master which is a library you can add as a submodule to your repo which wraps up the dialogue interface. And yes, obviously it reflects my own tastes (and strangenesses).

              I used it heavily when working on https://github.com/ThosRTanner/notepad-pp-linter/

              1 Reply Last reply Reply Quote 0
              • Chris FeskoC
                Chris Fesko
                last edited by

                Okay well i’m new here, not new to programming, however… Is there anyway to get this to work in VSC++ 6.0? Laugh all you want, i just do not like the .NET that was added in, and I just cant bring myself to use it, I mostly use vb6 for windows app programming, and c/c++ for more serious things which don’t worry too much about a User Interface.

                Im sure theres not, because of the fact your using vs 2022, and that has to mean without the dependencies, the project wont work either way. However is there a way to convert the project to vc++ 6.0? or I should ask is there a program out there that can do this, or could you do it if its possible, load the source code up into a vc++ 6.0 project. and save / upload it as a separate download?

                If not I am sorry for wasting your time, at least I got you laughing right?.. :( i’m not laughing I really cant stand the whole .NET thing… I wish they had never done any of that, It completely f’ed up Microsoft Visual studios…

                CoisesC ThosRTannerT 2 Replies Last reply Reply Quote 0
                • CoisesC
                  Coises @Chris Fesko
                  last edited by

                  @Chris-Fesko The binary interface to Notepad++ is entirely standard C (not C++).

                  That includes the docking dialogs, even though the existing model is presented in C++. If you look carefully, you’ll find that all the communication across the host/plugin boundary is plain C.

                  So you can absolutely write a plugin in anything that can present a C interface and compile to a DLL.

                  1 Reply Last reply Reply Quote 2
                  • ThosRTannerT
                    ThosRTanner @Chris Fesko
                    last edited by ThosRTanner

                    @Chris-Fesko using vs 2022 doesn’t mean the code is using .net. My code certainly isn’t. It’s standard c++ throughout (though it is c++20 so i’m not sure how well that work with vc++ 6.0)

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors