Page 1 of 1

Posted: Sat Oct 12, 2002 5:52 pm
by BackupUser
Restored from previous forum. Originally posted by plouf.

just to make another one post her :wink:)
this is a quick (4$dirty ?) tool i made to hold a TODO/Bugs list for every project i made it for yestarday since i like this way (i have saw it in an IDE dont remember which)

Code: Select all

  CODE updated below
Christos

Posted: Sat Oct 12, 2002 6:08 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.

Nice Plouf , its in my shortcuts :)

Let the tools come ppl :)

Regards,

Berikco

http://www.benny.zeb.be

Posted: Sat Oct 12, 2002 6:10 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

Nice tool Christos

Thanks

Using Windows 98 SE
Registered PB version : 3.40 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Sat Oct 12, 2002 6:21 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.

Does not remember window pos/size, should be nice :)


Regards,

Berikco

http://www.benny.zeb.be

Posted: Sat Oct 12, 2002 6:44 pm
by BackupUser
Restored from previous forum. Originally posted by plouf.

i wand to make it remember position its in my thougth's
also i thinking to make it save it is a single file
i promise to update it in the next days for these two thinks (since i mess up with OSes updates today)

Christos

Posted: Sat Oct 12, 2002 9:35 pm
by BackupUser
Restored from previous forum. Originally posted by plouf.

ok now it is remembers window Position and saves
them all in a single file you must delete old
.pjnl .pjtl .pjbl since they are useless now sorry
for that but i think its better that mess around with lots of files for 1 job

Code: Select all

; Basic ProjectNotepad for use in the new Editor Tools menu
; takes 1 parameter the %FILE 
; Take a look at the Code Below for Further Explanations :)
ProjectName.s = ProgramParameter()
#TODO  = 0 : TODOH = 60
#BUGS  = 1 : BUGSH = 60
#NOTES = 2 : NOTESH = 20
#CollapseButton = 3
#SaveButton = 4
If OpenPreferences("projectnotepad.prefs")
  width  = ReadPreferenceLong("WindowWidth",200) 
  height = ReadPreferenceLong("WindowHeight",170)
  winposx    = ReadPreferenceLong("WindowPositionX",0)
  winposy    = ReadPreferenceLong("WindowPositionY",0)
  collapsed  = ReadPreferenceLong("Collapsed",0)
  If Collapsed 
    lastheight = height : lastwidth = width 
    height = 24
  EndIf
  ClosePreferences() 
Else
  width = 200 : height = 170 
  winposx = GetSystemMetrics_(#SM_CXSCREEN)-width
  winposy = GetSystemMetrics_(#SM_CYMENU)
EndIf

If ReadFile(0,ProjectName+".pjnf") ; (r)ro(j)ect (n)otes (f)ile
  ReadString() ; move it to the second line 
  Repeat
    ToDoContents.s = ToDoContents.s + ReadString() + Chr(13) + Chr(10)
  Until Eof(0) Or Right(ToDoContents,9) = ";- Bugs"+Chr(13)+Chr(10)
  ToDoContents = Left(ToDoContents,Len(ToDoContents)-11)
  Repeat
    BugsContents.s = BugsContents.s + ReadString() + Chr(13)+ Chr(10)
  Until Eof(0) Or Right(BugsContents,10) = ";- Notes"+Chr(13)+Chr(10)
  BugsContents = Left(BugsContents,Len(BugsContents)-12)
  Repeat
    NotesContents.s = NotesContents.s + ReadString() + Chr(13)+ Chr(10)
  Until Eof(0)
  NotesContents = Left(NotesContents,Len(NotesContents)-2)
  CloseFile(0) 
Else:ToDoContents.s = "ToDo List" :BugsContents.s = "Bugs List" :NotesContents.s = "Notes"
EndIf

;- MAIN PROGRAM
OpenWindow(0,winposx,winposy,width,height,#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget,"ProjectNotepad")
  CreateGadgetList(WindowID())
    ButtonGadget(#CollapseButton,width-72,2,70,20,"Collapse /\")
    ButtonGadget(#SaveButton,2,2,70,20,"Save")
    StringGadget(#TODO ,2, 24,width-4,TODOH,ToDoContents,#ES_MULTILINE|#ES_AUTOVSCROLL|#WS_VSCROLL)
    StringGadget(#BUGS ,2,24+TODOH,width-4,BUGSH,BugsContents,#ES_MULTILINE|#ES_AUTOVSCROLL|#WS_VSCROLL)
    StringGadget(#NOTES,2,24+TODOH+BUGSH,width-4,NOTESH,NotesContents,#ES_MULTILINE|#ES_AUTOVSCROLL|#WS_VSCROLL)

  Repeat
    wevent = WaitWindowEvent()
    Gosub CheckEvent
  Until wevent = #PB_EventCloseWindow
  Gosub SaveLists
End
;- CheckEvent
CheckEvent: 
  Select wevent
    Case #PB_EventGadget
      Select EventGadgetID() 
        Case #CollapseButton
          If WindowHeight() = 24
            ResizeWindow(lastwidth,lastheight)
            SetGadgetText(#CollapseButton,"Collapse /\")
          Else
            lastwidth = WindowWidth():lastheight=WindowHeight()
            ResizeWindow(lastwidth,24)
            SetGadgetText(#CollapseButton,"Expand \/")
          EndIf
        Case #SaveButton
          Gosub SaveLists
      EndSelect
    Case #WM_SIZE
      temp = WindowHeight()
      TODOH =  ((temp/17)*6)
      BUGSH =  ((temp/17)*6)
      NOTESH = (temp-(29+TODOH+BUGSH))
      ResizeGadget(#TODO,2,27,WindowWidth()-4,TODOH)
      ResizeGadget(#BUGS,2,27+TODOH,WindowWidth()-4,BUGSH)
      ResizeGadget(#NOTES,2,27+TODOH+BUGSH,WindowWidth()-4,NOTESH)
      ResizeGadget(#CollapseButton,WindowWidth()-72,2,70,20)
  EndSelect
  If CreatePreferences("projectnotepad.prefs")
    WritePreferenceLong("WindowWidth",WindowWidth())
    If WindowHeight() = 24 
      Collapsed = 1 : 
    WritePreferenceLong("WindowHeight",lastHeight)
    Else 
      Collapsed = 0 
    WritePreferenceLong("WindowHeight",WindowHeight())
    EndIf
    WritePreferenceLong("WindowPositionX",WindowX())
    WritePreferenceLong("WindowPositionY",WindowY())
    WritePreferenceLong("Collapsed",Collapsed)
  EndIf
Return
;- SaveLists
SaveLists:
  If CreateFile(0,ProjectName+".pjnf")
    WriteStringN(";- Todo")
    WriteStringN(GetGadgetText(#TODO))
    WriteStringN(";- Bugs")
    WriteStringN(GetGadgetText(#BUGS))
    WriteStringN(";- Notes")
    WriteStringN(GetGadgetText(#NOTES))
  EndIf    
Return 
Christos

Posted: Sun Oct 13, 2002 8:06 am
by BackupUser
Restored from previous forum. Originally posted by Berikco.

That's better, thanks Cristos

I use only one day, and its full of idea's to implement in my project.

I see you found new category @ resource site also :)

Tip: if you use CallBack, you're window does redraw on the fly when you resize.


Regards,

Berikco

http://www.benny.zeb.be