twig / dcxdll

Dialog Control eXtensions for mIRC
BSD 3-Clause "New" or "Revised" License
23 stars 2 forks source link

Edit - does not display line numbering and impossible customize colors for lines #48

Closed EpicNet closed 3 years ago

EpicNet commented 3 years ago

I am using "mIRC v7.66" + "DCX dll v3.1-git394" in system "Windows 8.1 x64".

At the time of testing the control "Edit" when using the command "/xdid -g" emerge an error.

D_ERROR /xdid ("edit_test 2 -g 15728639 3090472 15728639 1774612" error: Invalid Command)

In addition when using the control style showlinenumbers it is supposed to display sequential line numbering (probably similar to what it looks like in the script editor), but it doesn't seem to work and needs to be repaired.

If I am doing something wrong, please explain what the problem might be. Thanks.


Here is a test piece of script to reproduce this the problem. To run the script click on "F5" or enter the command "/edit_test":

alias F5 { edit_test }
alias edit_test {
  if ($dialog(edit_test)) .dialog -x edit_test
  else { .dialog -m edit_test edit_test }
}
dialog edit_test {
  title "Edit test"
  icon $mircexe,0
  option pixels
  size -1 -1 300 210
}
on *:DIALOG:edit_test:init:*:{
  .dcx Mark $dname edit_test_work
  .xdialog -b $dname +tyz
  .xdialog -g $dname +b $rgb(20,20,27)
  .xdialog -c $dname 1 edit 40 40 210 23 showsel | edit_decor $dname 1
  .xdialog -c $dname 2 edit 40 85 210 78 multi showlinenumbers return showsel autovs | edit_decor $dname 2
}
alias edit_decor {
  .xdid -x $1 $2 +b
  .xdid -C $1 $2 +bk $rgb(40,40,47)
  .xdid -C $1 $2 +t $rgb(235,227,203)
  .xdid -f $1 $2 + ansi 10 Comic Sans MS
  if ($2 == 1) .xdid -a $1 $2 test edit
  if ($2 == 2) {
    .xdid -o $1 $2 1 test line 1
    .xdid -o $1 $2 2 test line 2
    .xdid -o $1 $2 3 test line 3
    .xdid -o $1 $2 4 test line 4
    .xdid -g $1 $2 $rgb(160,0,0) $rgb(40,40,47) $rgb(250,245,240) $rgb(250,245,240)
  }
}
alias edit_test_work {}
OokEek commented 3 years ago

Try with the latest version (3.1dev58git428)

EpicNet commented 3 years ago

If do not use the font setting, works fine, but if enable the font, then the field for line numbering is hidden behind the left border of the "Edit" control. Need to make additional adjustments to the code so that the line numbering field adjusts to the configured font and text size. And also need to do something with superfluous indents, or add some kind of parameter to command customization. In addition, the dividing vertical strip has only white color, which does not match the dark theme of the design. If possible, please add one more parameter to the "/xdid -g" command so that can adjust the color shade for the vertical dividing line.

image

Thanks for your hard work 👍

OokEek commented 3 years ago

I'm not getting any issues when changing the fonts, gutter adjusts fine to new font in code provided above. Manually issuing font commands also works OK. Has the code you are using changed from what's shown in OP?

EpicNet commented 3 years ago

Oh yeah, I tested with a slightly modified script, but it doesn't really affect anything. Even if I use the presented example in this thread, error with the departure of the line numbering field beyond the boundaries of the edit field persists and the vertical line is still white. I don’t know if the Windows system I’m using can have any effect on this. I noticed one peculiarity that this happens when the font "Comic Sans MS" is installed with a size of "10" and up. If I set the size to "9" or anything below this, then the problem disappears. Also, the numeric line numbering will be displayed when some other font is used, not similar to this one at any size. But this is repeated when using fonts "Tahoma" and "Verdana" starting from certain sizes.

Especially for this test, I change the font by entering manual commands:

/xdid -f edit_test 2 + ansi 10 Microsoft Sans Serif /xdid -f edit_test 2 + ansi 10 Comic Sans MS /xdid -f edit_test 2 + ansi 11 Tahoma /xdid -f edit_test 2 + ansi 9 Verdana /xdid -f edit_test 2 + ansi 9 Courier New

By the way, in the control "RichEdit" such a problem as the absence of a field for line numbering does not arise.

OokEek commented 3 years ago

think i have it fixed now.