It is currently Sat Oct 31, 2020 5:54 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 35 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Thu Sep 10, 2020 6:37 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1786
Location: Uttoxeter, UK
Brilliant!
Thank you for sharing. :D

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Thu Sep 10, 2020 6:52 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2690
Location: Germany
Super :D :D :D

Unfortunately 'WindowVectorOutout()' does not work with macOS (Catalina) anymore.
Solution for Style_LoadFont is to create a dummy image.

Line 3428
Code:
Procedure Style_LoadFont(*te.TE_STRUCT, *font.TE_FONT, fontName.s, fontSize, fontStyle = 0)
      ProcedureReturnIf((*te = #Null) Or (*font = #Null))
      
      Protected c, minTextWidth, image
      
      If IsFont(*font\nr)
         FreeFont(*font\nr)
      EndIf
      
      fontStyle | #PB_Font_HighQuality
      CompilerSelect #PB_Compiler_OS
        CompilerCase #PB_OS_Windows
          *font\nr                  = LoadFont(#PB_Any, fontName, fontSize / DesktopResolutionY() * 1.0, fontStyle)
        CompilerCase #PB_OS_MacOS
          *font\nr                  = LoadFont(#PB_Any, fontName, fontSize / DesktopResolutionY() * 1.2, fontStyle)
        CompilerCase #PB_OS_Linux
          *font\nr                  = LoadFont(#PB_Any, fontName, fontSize / DesktopResolutionY() * 1.0, fontStyle)
      CompilerEndSelect
      
      If IsFont(*font\nr)
         
         *font\style               = fontStyle
         *font\id               = FontID(*font\nr)
         *font\name               = fontName
         *font\size               = fontSize
         
         image = CreateImage(#PB_Any, 32, 32)
         If StartVectorDrawing(ImageVectorOutput(image))
            VectorFont(*font\id)
            
            minTextWidth         = VectorTextWidth(" ")
            *font\height         = VectorTextHeight(" ")
            *te\lineHeight         = *font\height
            
            For c = 0 To 255
               *font\width(c)      = Max(minTextWidth, VectorTextWidth(Chr(c)))
            Next
            *font\width(#TAB)         = minTextWidth
            
            StopVectorDrawing()
         EndIf
         FreeImage(image)
         ProcedureReturn #True
      EndIf
      
      ProcedureReturn #False
   EndProcedure
   

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Thu Sep 10, 2020 8:42 pm 
Offline
User
User

Joined: Sun Oct 09, 2011 7:39 am
Posts: 22
Thanks for the kind replies!
I already uploaded a new version with multilanguage support.

J. Baker wrote:
At idle, it uses 12% CPU and 64 MB of memory. I have an Intel 1.4 Ghz dual core CPU. Not bad. ;)

I think thats strage - 12% at Idle state is quite high, isn't it?

STARGÅTE wrote:
How long did you worked on this version?

I have worked quite a long time. Many weeks. Mainly because I didn't plan thoroughly in the beginning. So I had to rewrite large parts of the code over and over again.
When i started I didn't even knew about multicursor editing :lol:

oreopa wrote:
Column selection mode like UltraEdit would be a nice addition.

Did you try pressing down the "Alt"-key while selecting code with the mouse. Is that what you mean by "column selection"?

User_Russian wrote:
The editor only supports English characters and numbers.

That might be true. Unfortunately I have no clue what to do about it :oops:

infratec wrote:
I think horizontal and vertical split are swapped

In the new version they are swapped. I thought horizontal splitting means split the "x-axis" but it could also mean that a horizontal split is made on the y-axis...

Mesa wrote:
With windows XP 32, there is something wrong with the pop-up menu.

sorry, I didn't think about the XP users.
The adjustments for the Menutitles can be made in the new "language.cfg" file

mk-soft wrote:
Unfortunately 'WindowVectorOutout()' does not work with macOS (Catalina) anymore.

Thanks for the reply. Yes, a dummy image is a nice solution. Also the "multi-OS" part for the fontsize.


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Fri Sep 11, 2020 1:09 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 2075
Location: USA
Mr.L wrote:
I think thats strage - 12% at Idle state is quite high, isn't it?

It's most likely the blinking cursor having to redraw itself. Otherwise it would be much lower, if not zero percent. ;)

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Fri Sep 11, 2020 9:57 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 24, 2006 3:29 am
Posts: 262
Location: Edinburgh, Scotland.
Mr.L wrote:
oreopa wrote:
Column selection mode like UltraEdit would be a nice addition.

Did you try pressing down the "Alt"-key while selecting code with the mouse. Is that what you mean by "column selection"?


It kind of is, and it kind of isn't. :) I know thats not very helpful. It works nicely in tables that are regularly formatted, but in data with shorter lines, or lines with no data at all, it doesn't - its kind of a visual thing, but also a slightly different functionality thing as well. I think the simplest way to describe it is that top left and bottom right of the selection define a box which is the selection, and the cursor(s) are placed there (right side) and data typed or deleted happens there... even in lines with nothing but a <cr>... the selection is uniformly rectangular... i dunno if thats an accurate description... it's kinda hard to explain the subtle difference... phew...

It's not a big deal really. It's a very nice editor indeed.

EDIT: Redraw takes a paltry 0.45% on my ancient 1st gen i5... and (mega-huge) pasting is surprisingly fast...

_________________
Proud supporter of PB! * Musician * C64/6502 Freak


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 12, 2020 11:34 am 
Offline
User
User

Joined: Sun Oct 09, 2011 7:39 am
Posts: 22
@oreopa:
ah, now i see what you mean. But it would be tough to implement that feature into my editor, i guess.
Right now, in my editor the selection is directly connected to the textlines and you cannot select anything that "is not there".
So, i will keep that feature in mind and maybe one day i come up with a solution :wink:


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 12, 2020 6:39 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1786
Location: Uttoxeter, UK
@Mr.L ,

I have two questions:

1. Is there a pure text mode that ignores 'keywords'?
2. Can the background and text colours be changed?

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 12, 2020 7:03 pm 
Offline
User
User

Joined: Sun Oct 09, 2011 7:39 am
Posts: 22
davido wrote:
1. Is there a pure text mode that ignores 'keywords'?
2. Can the background and text colours be changed?


yes, if you comment the line (near the end of the code)
Code:
PBEdit_LoadStyle(0, "PB_Style.xml")

keywords, folding and indentation will be ignored.

inside the procedure "_PBEdit_::Editor_New"
you can find the line:
Code:
*te\colors\currentBackground = RGBA( 30,  30,  25, 255)

that's the background color

the default textcolor is defined in the procedure "_PBEdit_::Style_SetDefaultStyle"
Code:
Protected defaultColor = RGBA(155,220,255,255)


Maybe it's better to put all the editor color settings into a seperate file.


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 12, 2020 7:38 pm 
Offline
Addict
Addict

Joined: Fri Nov 09, 2012 11:04 pm
Posts: 1786
Location: Uttoxeter, UK
@Mr.L ,

That was quick!
Thank you. :D

_________________
DE AA EB


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 12, 2020 9:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 24, 2006 3:29 am
Posts: 262
Location: Edinburgh, Scotland.
Mr.L wrote:
@oreopa:
ah, now i see what you mean. But it would be tough to implement that feature into my editor, i guess.
Right now, in my editor the selection is directly connected to the textlines and you cannot select anything that "is not there".
So, i will keep that feature in mind and maybe one day i come up with a solution :wink:


Yes. I guessed that. I guess one would need to pad the "offending" lines out with tabs/spaces on the fly somehow.

Thx again, really is a work of art.

_________________
Proud supporter of PB! * Musician * C64/6502 Freak


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 12, 2020 10:29 pm 
Offline
User
User

Joined: Sun Oct 09, 2011 7:39 am
Posts: 22
A new version is online (1.0.2)

Download

added: Settings file "PBEdit.xml"
all editor settings and colors can be changed inside this file.


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Thu Sep 24, 2020 2:54 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 21, 2011 9:11 am
Posts: 619
Location: France
Whoooo! I love it. Congratulations for this code

_________________

➽ Windows 10 - PB 5.72(x64)

Sorry for my bad english and the Dunning–Kruger effect.


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 26, 2020 8:43 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 24, 2012 10:19 am
Posts: 197
You can download the french translation, here:
http://frazier.wood.free.fr/pb/language_FR.cfg

M.


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 26, 2020 11:37 am 
Offline
User
User

Joined: Sun Oct 09, 2011 7:39 am
Posts: 22
thank you, Mesa!
I've uploaded a new version (1.0.5 - see first post) that includes your translation!


Top
 Profile  
Reply with quote  
 Post subject: Re: PBEdit - a Canvas-based Texteditor
PostPosted: Sat Sep 26, 2020 7:42 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Apr 05, 2020 11:28 am
Posts: 288
Location: Pandora
Hi,
the flickering of the text below, when the mouse is moved, or other, can be removed completely with a trick.

Code:
      Case #PB_Event_Gadget
        lineNr$="lineNr: " + Str(PBEdit_GetCurrentLineNr(0)) +
                "  Column: " + Str(PBEdit_GetCurrentColumnNr(0)) +
                "  (Char: " + Str(PBEdit_GetCurrentCharNr(0)) + ")"
        If lineNr$<>old_lineNr$
          StatusBarText(0, 0, lineNr$)
          old_lineNr$=lineNr$
        EndIf
       
        selection$="Selection [" +
                   Str(PBEdit_GetFirstSelectedLineNr(0)) + ", " +
                   Str(PBEdit_GetFirstSelectedCharNr(0)) + "] [" +
                   Str(PBEdit_GetLastSelectedLineNr(0)) + ", " +
                   Str(PBEdit_GetLastSelectedCharNr(0)) + "]"
        If selection$<>old_selection$
          StatusBarText(0, 1, selection$)
          old_selection$=selection$
        EndIf
       
        If ListSize(*te\cursor())<>old_cursors_changed
          StatusBarText(0, 2, "Cursors: " + Str(ListSize(*te\cursor())))
          old_cursors_changed=ListSize(*te\cursor())
        EndIf

Best Regards Saki

_________________
地球上の平和


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 12 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