Author Topic: Reformat a DCL file.  (Read 2728 times)

0 Members and 1 Guest are viewing this topic.

rik

  • Guest
Reformat a DCL file.
« on: August 10, 2011, 09:04:18 AM »
How can I automatically reformat (arrange) a DCL file?
Change this
Code: [Select]
DCL1 : dialog { label="My Dialog"; : image_button  { key        = "MyImage1" ;
width      = 25.0 ; height     =  4.0 ; color     = black ; alignment     = top ;
is_tab_stop = false ;} : button { key        = "Button1" ;
label      = "MyButton" ; width      = 25 ; height     =  2.0 ;
alignment     = top ; is_tab_stop = false ;} ok_cancel;}
to
Code: [Select]
DCL1 : dialog {
    label="My Dialog";
        : image_button  {
            key        = "MyImage1" ;
            width      = 25.0 ;
            height     =  4.0 ;
            color     = black ;
            alignment     = top ;
            is_tab_stop = false ;
        }
        : button {
            key        = "Button1" ;
            label      = "MyButton" ;
            width      = 25 ;
            height     =  2.0 ;
            alignment     = top ;
            is_tab_stop = false ;
        }
ok_cancel;
}
Thanks for reading.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reformat a DCL file.
« Reply #1 on: August 10, 2011, 10:13:55 AM »
« Last Edit: August 10, 2011, 03:09:20 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

GDF

  • Water Moccasin
  • Posts: 2081
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

rik

  • Guest
Re: Reformat a DCL file.
« Reply #3 on: August 11, 2011, 02:24:56 PM »
Thanks CAD and GDF,

I found no real solution for my problem.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: Reformat a DCL file.
« Reply #4 on: August 11, 2011, 03:05:59 PM »
I hate to say this but...Vim can

quick two pass search and replace.
Code: [Select]
:%s/;/;\r/g | :%s/{/{\r/g
Code: [Select]
DCL1 : dialog { label="My Dialog"; : image_button  { key        = "MyImage1" ;
width      = 25.0 ; height     =  4.0 ; color     = black ; alignment     = top ;
is_tab_stop = false ;} : button { key        = "Button1" ;
label      = "MyButton" ; width      = 25 ; height     =  2.0 ;
alignment     = top ; is_tab_stop = false ;} ok_cancel;}

goes to:

Code: [Select]
DCL1 : dialog {
    label="My Dialog";
    : image_button  {
        key        = "MyImage1" ;

        width      = 25.0 ;
        height     =  4.0 ;
        color     = black ;
        alignment     = top ;

        is_tab_stop = false ;
    } : button {
        key        = "Button1" ;

        label      = "MyButton" ;
        width      = 25 ;
        height     =  2.0 ;

        alignment     = top ;
        is_tab_stop = false ;
    } ok_cancel;
}

TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Reformat a DCL file.
« Reply #5 on: August 11, 2011, 03:11:05 PM »
I hate to say this but...Vim can
nice
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox