gschem is unable to (re)load custom color map at runtime

Bug #1565465 reported by dmn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gEDA
Won't Fix
Wishlist
Unassigned

Bug Description

Designing a color scheme for gschem is a tedious task.
You have to reload the application each time you've changed
a color in your color map file to see the result.
However, it's easy to provide such a functionality
trough guile function, so that a user can bind a key
to call it to reload colors at runtime.
So, here is the patch.

Revision history for this message
dmn (graahnul.grom) wrote :
Revision history for this message
Vladimir Zhbanov (vzhbanov) wrote :

Hi Dmitry,

Are you sure? I am not ;)

Look at
  https://github.com/vzh/gschem-goodies/tree/master/examples/colormap

As you can see there is no need to touch gschem internals to do
what you want.

  Vladimir

Changed in geda:
status: New → Won't Fix
importance: Undecided → Wishlist
Revision history for this message
dmn (graahnul.grom) wrote :

Hi, Vladimir!
  Thank you for the script, it works.
Though, for some reason, to make it work I had to add
'( use-modules ( geda page ) )'.
  But the whole point was to be able to switch between color
schemes and to reload current scheme at runtime - without
restarting gschem. This way external color scheme editing tool
can be used - for example, using standard gtk color selection
component, which would be much more convinient, IMHO.

Revision history for this message
Vladimir Zhbanov (vzhbanov) wrote : Re: [Bug 1565465] Re: gschem is unable to (re)load custom color map at runtime

On 7/20/16, graahnul.grom <email address hidden> wrote:
> Hi, Vladimir!
> Thank you for the script, it works.
> Though, for some reason, to make it work I had to add
> '( use-modules ( geda page ) )'.

Fixed [1], thanks!

> But the whole point was to be able to switch between color
> schemes and to reload current scheme at runtime - without
> restarting gschem. This way external color scheme editing tool

If you read the comment to the procedure set-color! you would know
the point about colormap reloading.

Basically, you can just do:

(display-color-map (primitive-eval (with-input-from-file
"/tmp/mycolormap" read)))

where "/tmp/mycolormap" contains, e.g.

--------------------------------8<--------------------------------
'((background "#00ff88")
  (bus "#000000"))
-------------------------------->8--------------------------------

Then you can use already available Scheme functions to call
gschem file choosing dialog and, say, combine it all in one
procedure and bind it to a shortcut. Look through gschem
documentation to find more info on the functions needed. The key
binding examples exist in the same repository.

If you do this and publish the result then users would be able to
easily share the colormaps they prepared :-)

> can be used - for example, using standard gtk color selection
> component, which would be much more convinient, IMHO.
>

Yes, I would love the standard gtk color dialog in gschem. Patches
are welcome. You can work in the central repository, if you want.

[1] https://github.com/vzh/gschem-goodies/commit/e6da0325d6a387457959598c90887ab427eb0371

Revision history for this message
dmn (graahnul.grom) wrote :

> (display-color-map (primitive-eval (with-input-from-file
> "/tmp/mycolormap" read)))

It works, except:
1) background does not change color
2) colors in Edit->Color dialog do not change

It seems that we need to call x_color_free()/x_color_allocate(),
anyway. These are in gschem (x_color.c).
display-color-map() is in libgeda.

Is there another way that I miss?
Or is it, after all, makes sense to add a function to gschem?

> You can work in the central repository, if you want.
Thank you. Though, I'm not an expert in git.
//
// как бы не поломать чего. стремновато, честно говоря... :)

Revision history for this message
Vladimir Zhbanov (vzhbanov) wrote :

> 1) background does not change color

You have to use the last gschem from git, it should work. At
least, it works for me (c)

> 2) colors in Edit->Color dialog do not change

Yes, this part needs some more work.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.