EDA365电子工程师网

标题: 想写个 color form 不会,求帮忙 [打印本页]

作者: pallayout    时间: 2014-11-10 16:24
标题: 想写个 color form 不会,求帮忙

想写个自定义的 color Form ,不会,求大神们帮忙完善一下outline那个按钮的代码
不会的有
1. 如何判断outline 层已显示?
2. 当outline 层已显示时,那个color按钮如何变成outline 层的颜色,且感觉有被按下的效果
3. 当outline 层不显示时,那个color按钮如何变成黑色,且感觉没有被按下的效果
  1. /*********************************************************/
  2. /*               Title :  pal Color                     */
  3. /*     Execute Command :  PalColor                     */
  4. /*              Author :  tatarlxw                       */
  5. /*       Creation Date :  2014-10-30                     */
  6. /*              Update :                                 */
  7. /*             Version :  1.0                            */
  8. /*            Web site :  http://hi.baidu.com/tatarlxw   */
  9. /*              E-mail :  tatarlxw@163.com               */
  10. /*********************************************************/

  11. axlCmdRegister("PalColor" 'PalColor)
  12. defun( PalColor ()
  13.   formFileName = "./PalColor.form"
  14.   PalColor_form_create()
  15.   
  16.   ;PalColor_form = axlMiniStatusLoad('form, formFileName 'PalColor_action t)
  17.   PalColor_form = axlFormCreate( (gensym) formFileName `(ne inner "msglines" 2) `PalColor_action t nil)
  18.   axlFormDisplay(PalColor_form)
  19.   deleteFile(formFileName)
  20.   axlControlRaise('options)
  21. )

  22. defun(PalColor_action (PalColor_form)
  23. case(PalColor_form->curField
  24.    ("clrOutline"
  25.            axlVisibleLayer( "BOARD GEOMETRY/OUTLINE" t )
  26.    )
  27.    ("btnVisAllOn"
  28.      axlShell( "setwindow pcb")
  29.      axlShell( "etchedit")
  30.      axlShell( "color192")
  31.      axlShell( "setwindow cvf.dialog")
  32.      axlShell( "cvf layer_mode")
  33.      axlShell( "setwindow pcb")
  34.      axlShell( "etchedit")
  35.      axlShell( "setwindow cvf.dialog")
  36.      axlShell( "cvf global_visible")
  37.      axlShell( "cvf okay")
  38.      axlShell( "setwindow pcb")
  39.      axlShell( "")
  40.    )
  41.    ("btnVisAllOff"
  42.      axlShell( "setwindow pcb")
  43.      axlShell( "etchedit")
  44.      axlShell( "color192")
  45.      axlShell( "setwindow cvf.dialog")
  46.      axlShell( "cvf layer_mode")
  47.      axlShell( "setwindow pcb")
  48.      axlShell( "etchedit")
  49.      axlShell( "setwindow cvf.dialog")
  50.      axlShell( "cvf global_invisible")
  51.      axlShell( "cvf okay")
  52.      axlShell( "setwindow pcb")
  53.      axlShell( "")
  54.    )

  55. ))

  56. procedure(PalColor_form_create()
  57.         lstForm = outfile( formFileName "w")
  58.         fprintf(lstForm "FILE_TYPE=FORM_DEFN VERSION=2\n")
  59.         fprintf(lstForm "FORM\n")
  60.         fprintf(lstForm "FIXED\n")
  61.         fprintf(lstForm "PORT 20 10\n")
  62.         fprintf(lstForm "HEADER \"Change Block\"\n")
  63.         fprintf(lstForm "TILE\n")
  64.        
  65.         fprintf(lstForm "TEXT \"Global Visibility:\"\n")
  66.         fprintf(lstForm "FLOC 2 1\n")
  67.         fprintf(lstForm "ENDTEXT\n")
  68.        
  69.         fprintf(lstForm "FIELD btnVisAllOn\n")
  70.         fprintf(lstForm "FLOC 10 1\n")
  71.         fprintf(lstForm "MENUBUTTON \"On\" 5 3\n")
  72.         fprintf(lstForm "ENDFIELD\n")

  73.         fprintf(lstForm "FIELD btnVisAllOff\n")
  74.         fprintf(lstForm "FLOC 16 1\n")
  75.         fprintf(lstForm "MENUBUTTON \"Off\" 5 3\n")
  76.         fprintf(lstForm "ENDFIELD\n")
  77.        
  78.         fprintf(lstForm "TEXT \"Outline\"\n")
  79.         fprintf(lstForm "FLOC 2 4\n")
  80.         fprintf(lstForm "ENDTEXT\n")

  81.         fprintf(lstForm "FIELD clrOutline\n")
  82.         fprintf(lstForm "FLOC 10 4\n")
  83.         fprintf(lstForm "COLOR 3 1\n")
  84.         fprintf(lstForm "ENDFIELD\n")
  85.        
  86.         fprintf(lstForm "ENDTILE\n")
  87.         fprintf(lstForm "ENDFORM\n")
  88.         close(lstForm)
  89. )

  90.        
  91.        
复制代码

作者: kevin890505    时间: 2014-11-10 17:12
ALXISVISIABLELAYER(XXX)貌似   检查层是否打开   颜色设置貌似axlformcolorset   查下说明吧
作者: pallayout    时间: 2014-11-10 18:47
本帖最后由 pallayout 于 2014-11-10 23:02 编辑

颜色设置貌似axlformcolorset  ?
再请高人指点一下
作者: pallayout    时间: 2014-11-10 18:53
还有我需要刷屏,即allegro中的 redraw 命令
好像不是axlFlushDisplay() 这个函数,那是哪条了,
作者: pallayout    时间: 2014-11-10 19:20
都搞定了,axlLayerGet 是这个函数
作者: pallayout    时间: 2014-11-10 19:32
本帖最后由 pallayout 于 2014-11-10 23:01 编辑

新的问题,如何判断与设置color按钮是否按下
  ;当outline已显示时,在程序加载时,不知如何让color按钮达到自动按下效果。
  if(axlIsVisibleLayer("BOARD GEOMETRY/OUTLINE") then
     clrlayer=axlLayerGet("BOARD GEOMETRY/OUTLINE")
     axlFormSetField( PalColor_form "clrOutline" clrlayer->color )
         ;在这里加点啥?能让color按钮有按下效果?
  else
         axlFormSetField( PalColor_form "clrOutline" 'black)
    )
就差这一小步了,哪位大神帮帮忙

作者: betamelody    时间: 2014-11-11 09:57
axlVisibleUpdate(nil)
作者: pallayout    时间: 2014-11-12 16:16
太感谢了,已搞定,
作者: kkman2000    时间: 2015-8-20 18:27
支持楼主原创  非常感谢!
作者: liuanty    时间: 2016-6-4 08:03
学习一下!




欢迎光临 EDA365电子工程师网 (http://bbs.elecnest.cn/) Powered by Discuz! X3.2