Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 02:40 03 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Font editor SimpleEd for CMM2

     Page 2 of 3    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5911
Posted: 01:25am 27 Jan 2021
Copy link to clipboard 
Print this post

If your users have set the mouse in OPTIONs,
mouse_port = MM.INFO(OPTION MOUSE)
 IF mouse_port > -1 THEN ' we have a mouse
   CONTROLLER MOUSE OPEN mouse_port
 ENDIF

MM.INFO(OPTION MOUSE) returns -1 for mouse port not set.

I guess you should still have code to catch a mouse set but not plugged it but I would keep -1 as the no-mouse number.

Using a mouse for things like this is much easier (for me anyway).

Jim
VK7JH
MMedit   MMBasic Help
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 06:28pm 27 Jan 2021
Copy link to clipboard 
Print this post

  TassyJim said  If your users have set the mouse in OPTIONs,
mouse_port = MM.INFO(OPTION MOUSE)
 IF mouse_port > -1 THEN ' we have a mouse
   CONTROLLER MOUSE OPEN mouse_port
 ENDIF

MM.INFO(OPTION MOUSE) returns -1 for mouse port not set.

I guess you should still have code to catch a mouse set but not plugged it but I would keep -1 as the no-mouse number.

Using a mouse for things like this is much easier (for me anyway).

Jim


Hi Jim,
I have still just HT mouse in CMM2 deluxe, didn't test PS/2 mouse yet. But I thought the OPTION MOUSE is just for EDITOR and FILE EXPLORER, so in normal operation I need still test it like I did it in SimplEd, just start with port #0.
Am I right?

An yes, true, (maybe) I need somehow solve disconnecting during program use  
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 07:55pm 27 Jan 2021
Copy link to clipboard 
Print this post

I use the following:
mport = mm.info(option mouse) + 1
if mport then
 controller mouse open mport-1, LeftClick
 gui cursor on 2
 settick 50, PeriodInt   ' periodic interrupt to move mouse pointer
else    ' no mouse set so try find one
 mport = 4
 do
   on error skip
   controller mouse open mport-1, LeftClick
   if MM.ERRNO then
     mport = mport - 1
   else
     gui cursor on 2
     settick 50, PeriodInt   ' periodic interrupt to move mouse pointer
     exit do
   endif
 loop until mport = 0  ' no mouse found anywhere
endif

mport holds the mouse port number PLUS ONE.
Visit Vegipete's *Mite Library for cool programs.
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 09:07pm 27 Jan 2021
Copy link to clipboard 
Print this post

So combination of my current test in SimplEd now and test for port 0. OK, I will change it to the same...

Thanks!
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5911
Posted: 09:25pm 27 Jan 2021
Copy link to clipboard 
Print this post

  jirsoft said  
Hi Jim,
I have still just HT mouse in CMM2 deluxe, didn't test PS/2 mouse yet. But I thought the OPTION MOUSE is just for EDITOR and FILE EXPLORER, so in normal operation I need still test it like I did it in SimplEd, just start with port #0.
Am I right?

An yes, true, (maybe) I need somehow solve disconnecting during program use  

I work on the theory that if you have a mouse connected, you will want to use it in the editor and file manager so you will have OPTION MOUSE set.

A user could use one mouse for the editor and a different one for games so the ability to override the mouse selection might be needed.
Reading the OPTION to see which mouse the user prefers is a convenience but certainly not required.

Jim
VK7JH
MMedit   MMBasic Help
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 09:47pm 27 Jan 2021
Copy link to clipboard 
Print this post

Hi,
I uploaded SimplEd v 0.32 with (hopefully) better mouse init. When mouse is selected, it shows mouse image in the logo...

SUB SEinitMouse
 'try to find mouse and set MOU.SE to it's port

 LOCAL INTEGER i
 IF MM.INFO(VERSION) >= 5.07 THEN
   MOU.SE = MM.INFO(OPTION MOUSE)
   ON ERROR SKIP
   CONTROLLER MOUSE OPEN MOU.SE
   IF MM.ERRNO <> 0 THEN
     MOU.SE = -1
   ENDIF
 ELSE
   MOU.SE = -1
 ENDIF
 FOR i = 1 TO 3
   IF MOU.SE < 0 THEN
     ON ERROR SKIP
     CONTROLLER MOUSE OPEN i
     IF MM.ERRNO = 0 THEN
       MOU.SE = i
     ENDIF
   ENDIF
   IF MOU.SE >= 0 THEN
     IF TUIquestion("MOUSE TEST", "Mouse found on port " + STR$(MOU.SE) + ", use it?") THEN
       LOAD PNG "Mouse.PNG", 640, 50
       GUI CURSOR ON 0, MOUSE(X, MOU.SE), MOUSE(Y, MOU.SE), RGB(GREEN)
     ELSE
       MOU.SE = -1
     ENDIF
     EXIT SUB
   ENDIF
 NEXT i
END SUB

Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 10:20pm 27 Jan 2021
Copy link to clipboard 
Print this post

I don't think that is quite right.

You loop from 1 to 3 looking for a mouse. But 0 is a valid mouse port too.

Also, software that nags with questions that are almost always 'YES' is a royal nuisance. Maybe make a best guess as to which mouse port to use (use the one in MM.INFO(OPTION MOUSE) if available, otherwise test from 0 to 3 and pick the first one found) and offer a key command to choose a different one.
Visit Vegipete's *Mite Library for cool programs.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5911
Posted: 10:57pm 27 Jan 2021
Copy link to clipboard 
Print this post

Perhaps you could use this method:
If a file "SimplEd.inf" exists, use it to load your preferences.
That way users only have to answer questions once.

Jim
VK7JH
MMedit   MMBasic Help
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 12:42pm 28 Jan 2021
Copy link to clipboard 
Print this post

  vegipete said  I don't think that is quite right.

You loop from 1 to 3 looking for a mouse. But 0 is a valid mouse port too.

Also, software that nags with questions that are almost always 'YES' is a royal nuisance. Maybe make a best guess as to which mouse port to use (use the one in MM.INFO(OPTION MOUSE) if available, otherwise test from 0 to 3 and pick the first one found) and offer a key command to choose a different one.


I'm testing the port 0 as first, when is OK then not needed any more:
IF MM.INFO(VERSION) >= 5.07 THEN
  MOU.SE = MM.INFO(OPTION MOUSE)
  ON ERROR SKIP
  CONTROLLER MOUSE OPEN MOU.SE
  IF MM.ERRNO <> 0 THEN
    MOU.SE = -1
  ENDIF
ELSE
  MOU.SE = -1
ENDIF
...
IF MOU.SE >= 0 THEN ...


But I will try on weeekend prepare PS/2 mouse and test both PS/2 and HT...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 12:48pm 28 Jan 2021
Copy link to clipboard 
Print this post

  TassyJim said  Perhaps you could use this method:
If a file "SimplEd.inf" exists, use it to load your preferences.
That way users only have to answer questions once.

Jim


Hi Jim,
you are partially right, but for example I'm using same SD card in both CMM2s of mine (400 MHz and 480 MHz Deluxe with HT), so then will be problem with the missing question...

And I have also tested PS/2 mouse without mouse connected, with OPTION MOUSE 0 and it was pretty bad experience: after jumping into EDIT or FILE EXPLORER I have got mouse timeout and was kicked out of it, so both can't be used without mouse when configured. How is it when you disconnect PS/2 mouse during EDIT or FILE EXPLORER? With HT mouse it's no problem...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 06:15pm 28 Jan 2021
Copy link to clipboard 
Print this post

  jirsoft said  I'm testing the port 0 as first, when is OK then not needed any more:
IF MM.INFO(VERSION) >= 5.07 THEN
  MOU.SE = MM.INFO(OPTION MOUSE)

No, you are just testing the port that OPTION MOUSE is set to.
Visit Vegipete's *Mite Library for cool programs.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 06:19pm 28 Jan 2021
Copy link to clipboard 
Print this post

  jirsoft said  And I have also tested PS/2 mouse without mouse connected, with OPTION MOUSE 0 and it was pretty bad experience: after jumping into EDIT or FILE EXPLORER I have got mouse timeout and was kicked out of it, so both can't be used without mouse when configured. How is it when you disconnect PS/2 mouse during EDIT or FILE EXPLORER? With HT mouse it's no problem...

I've seen the mouse timeout event too. I would suggest the firmware ought to behave a bit more gracefully if OPTION MOUSE is set to a port with no mouse. It would also be nice if OPTION MOUSE -1 was valid, in addition to OPTION MOUSE OFF.
Visit Vegipete's *Mite Library for cool programs.
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 07:25pm 28 Jan 2021
Copy link to clipboard 
Print this post

OK,
I tried to incorporate Pete's and Jim's comments about mouse handling into code , so v0.33 is online...

Enjoy!

And Pete + Jim: BIG thank you!  
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1082
Posted: 01:04am 29 Jan 2021
Copy link to clipboard 
Print this post

For lines 137 and 138, you have:
 LOCAL INTEGER x = MOUSE(X. MOU.SE), y = MOUSE(Y. MOU.SE)
 LOCAL INTEGER l = MOUSE(L. MOU.SE), r = MOUSE(R. MOU.SE), w = MOUSE(W. MOU.SE)

Some of the periods (.) must be changed to commas (,)
 LOCAL INTEGER x = MOUSE(X, MOU.SE), y = MOUSE(Y, MOU.SE)
 LOCAL INTEGER l = MOUSE(L, MOU.SE), r = MOUSE(R, MOU.SE), w = MOUSE(W, MOU.SE)

Visit Vegipete's *Mite Library for cool programs.
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 09:37am 29 Jan 2021
Copy link to clipboard 
Print this post

Thanks Pete,
I have to be blind, I will fix it at evening. I have anyway problem with the colors and font in editor, for me will be perfect, when is somewhere to possbile to configure it...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 12:06pm 30 Jan 2021
Copy link to clipboard 
Print this post

Fixed...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 04:49pm 01 Feb 2021
Copy link to clipboard 
Print this post

New version of SimplEd (0.35) is here with 2 new features:

First is smaller, but useful, with CTRL+S you swap current character and CLIP, so you can for example faster reorder wrong characters in font

Second is much bigger, you can now in import select also image and  scan it to font. It still needs to be polished, but already works pretty well. Because of it, now you need GRF.INC also for SimplEd (it's on GitHub included in SimplEd repository)...

From this

You will get this



And from this (Mauro's font in DemoX)


You will getthis


Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Holger
Newbie

Joined: 04/11/2020
Location: Germany
Posts: 11
Posted: 06:45pm 01 Feb 2021
Copy link to clipboard 
Print this post

Wow,

that is amazing.




Too sad, that Multicolor Fonts are not supported yet.  
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 12:25pm 02 Feb 2021
Copy link to clipboard 
Print this post

Jiri,
The Github SimpleEd v0.35 code has the //LIB #INCLUDES for the GRF and TUI files still active. The commenting needs to be swapped.

Greg
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 532
Posted: 04:33pm 02 Feb 2021
Copy link to clipboard 
Print this post

  paceman said  Jiri,
The Github SimpleEd v0.35 code has the //LIB #INCLUDES for the GRF and TUI files still active. The commenting needs to be swapped.

Greg

Thanks Greg, fixed.
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
     Page 2 of 3    
Print this page
© JAQ Software 2024