File: m_popup_menu.srm
Size: 9624
Date: Wed, 18 Jan 2017 04:51:04 +0100
$PBExportHeader$m_popup_menu.srm
forward
global type m_popup_menu from menu
end type
type m_popup from menu within m_popup_menu
end type
type m_undo from menu within m_popup
end type
type m_redo from menu within m_popup
end type
type m_-2 from menu within m_popup
end type
type m_cut from menu within m_popup
end type
type m_copy from menu within m_popup
end type
type m_paste from menu within m_popup
end type
type m_delete from menu within m_popup
end type
type m_-3 from menu within m_popup
end type
type m_selectall from menu within m_popup
end type
type m_1 from menu within m_popup
end type
type m_commentselection from menu within m_popup
end type
type m_uncommentselection from menu within m_popup
end type
type m_dash_web from menu within m_popup
end type
type m_websearch from menu within m_popup
end type
type m_gotowebsite from menu within m_popup
end type
type m_popup from menu within m_popup_menu
m_undo m_undo
m_redo m_redo
m_-2 m_-2
m_cut m_cut
m_copy m_copy
m_paste m_paste
m_delete m_delete
m_-3 m_-3
m_selectall m_selectall
m_1 m_1
m_commentselection m_commentselection
m_uncommentselection m_uncommentselection
m_dash_web m_dash_web
m_websearch m_websearch
m_gotowebsite m_gotowebsite
end type
global type m_popup_menu from menu
m_popup m_popup
end type
end forward

global type m_popup_menu from menu
m_popup m_popup
end type
global m_popup_menu m_popup_menu

forward prototypes
public subroutine mf_editstatus (boolean ab_cancopy, boolean ab_canpaste, boolean ab_canredo, boolean ab_canundo, long al_textlen, string as_selectedtext)
end prototypes

public subroutine mf_editstatus (boolean ab_cancopy, boolean ab_canpaste, boolean ab_canredo, boolean ab_canundo, long al_textlen, string as_selectedtext);// enable/disable options

m_popup.m_undo.enabled     = ab_canundo
m_popup.m_redo.enabled     = ab_canredo
m_popup.m_cut.enabled      = ab_cancopy
m_popup.m_copy.enabled     = ab_cancopy
m_popup.m_paste.enabled    = ab_canpaste
m_popup.m_delete.enabled   = ab_cancopy

m_popup.m_commentselection.enabled   = ab_cancopy
m_popup.m_uncommentselection.enabled = ab_cancopy

If al_textlen = 0 Then
   m_popup.m_selectall.enabled = False
Else
   m_popup.m_selectall.enabled = True
End If

// determine if selected text is an URL or a search term
m_popup.m_dash_web.visible = False
m_popup.m_websearch.visible = False
m_popup.m_gotowebsite.visible = False
If as_selectedtext <> "" Then
   m_popup.m_dash_web.visible = True
   If gn_app.PathIsURL(as_selectedtext) Then
      m_popup.m_gotowebsite.visible = True
   Else
      m_popup.m_websearch.visible = True
   End If
End If

end subroutine

on m_popup_menu.create
m_popup_menu=this
call super::create
this.text = "m_popup_menu"
this.m_popup=create m_popup
this.Item[UpperBound(this.Item)+1]=this.m_popup
end on

on m_popup_menu.destroy
call super::destroy
destroy(this.m_popup)
end on

type m_popup from menu within m_popup_menu
m_undo m_undo
m_redo m_redo
m_-2 m_-2
m_cut m_cut
m_copy m_copy
m_paste m_paste
m_delete m_delete
m_-3 m_-3
m_selectall m_selectall
m_1 m_1
m_commentselection m_commentselection
m_uncommentselection m_uncommentselection
m_dash_web m_dash_web
m_websearch m_websearch
m_gotowebsite m_gotowebsite
end type

on m_popup.create
call super::create
this.text = "Popup"
this.m_undo=create m_undo
this.m_redo=create m_redo
this.m_-2=create m_-2
this.m_cut=create m_cut
this.m_copy=create m_copy
this.m_paste=create m_paste
this.m_delete=create m_delete
this.m_-3=create m_-3
this.m_selectall=create m_selectall
this.m_1=create m_1
this.m_commentselection=create m_commentselection
this.m_uncommentselection=create m_uncommentselection
this.m_dash_web=create m_dash_web
this.m_websearch=create m_websearch
this.m_gotowebsite=create m_gotowebsite
this.Item[UpperBound(this.Item)+1]=this.m_undo
this.Item[UpperBound(this.Item)+1]=this.m_redo
this.Item[UpperBound(this.Item)+1]=this.m_-2
this.Item[UpperBound(this.Item)+1]=this.m_cut
this.Item[UpperBound(this.Item)+1]=this.m_copy
this.Item[UpperBound(this.Item)+1]=this.m_paste
this.Item[UpperBound(this.Item)+1]=this.m_delete
this.Item[UpperBound(this.Item)+1]=this.m_-3
this.Item[UpperBound(this.Item)+1]=this.m_selectall
this.Item[UpperBound(this.Item)+1]=this.m_1
this.Item[UpperBound(this.Item)+1]=this.m_commentselection
this.Item[UpperBound(this.Item)+1]=this.m_uncommentselection
this.Item[UpperBound(this.Item)+1]=this.m_dash_web
this.Item[UpperBound(this.Item)+1]=this.m_websearch
this.Item[UpperBound(this.Item)+1]=this.m_gotowebsite
end on

on m_popup.destroy
call super::destroy
destroy(this.m_undo)
destroy(this.m_redo)
destroy(this.m_-2)
destroy(this.m_cut)
destroy(this.m_copy)
destroy(this.m_paste)
destroy(this.m_delete)
destroy(this.m_-3)
destroy(this.m_selectall)
destroy(this.m_1)
destroy(this.m_commentselection)
destroy(this.m_uncommentselection)
destroy(this.m_dash_web)
destroy(this.m_websearch)
destroy(this.m_gotowebsite)
end on

type m_undo from menu within m_popup
end type

on m_undo.create
call super::create
this.text = "Undo"
this.microhelp = "Undo last command"
end on

on m_undo.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_redo from menu within m_popup
end type

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

on m_redo.create
call super::create
this.text = "Redo"
this.microhelp = "Redo the last undone command"
end on

on m_redo.destroy
call super::destroy
end on

type m_-2 from menu within m_popup
end type

on m_-2.create
call super::create
this.text = "-"
end on

on m_-2.destroy
call super::destroy
end on

type m_cut from menu within m_popup
end type

on m_cut.create
call super::create
this.text = "Cut"
this.microhelp = "Cut selected to clipboard"
end on

on m_cut.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_copy from menu within m_popup
end type

on m_copy.create
call super::create
this.text = "Copy"
this.microhelp = "Copy selected to clipboard"
end on

on m_copy.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_paste from menu within m_popup
end type

on m_paste.create
call super::create
this.text = "Paste"
this.microhelp = "Paste from clipboard"
end on

on m_paste.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_delete from menu within m_popup
end type

on m_delete.create
call super::create
this.text = "Delete"
this.microhelp = "Delete selected"
end on

on m_delete.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_-3 from menu within m_popup
end type

on m_-3.create
call super::create
this.text = "-"
end on

on m_-3.destroy
call super::destroy
end on

type m_selectall from menu within m_popup
end type

on m_selectall.create
call super::create
this.text = "Select All"
this.microhelp = "Select all"
end on

on m_selectall.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_1 from menu within m_popup
end type

on m_1.create
call super::create
this.text = "-"
end on

on m_1.destroy
call super::destroy
end on

type m_commentselection from menu within m_popup
end type

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

on m_commentselection.create
call super::create
this.text = "Comment Selection"
this.microhelp = "Comment the selected lines"
end on

on m_commentselection.destroy
call super::destroy
end on

type m_uncommentselection from menu within m_popup
end type

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

on m_uncommentselection.create
call super::create
this.text = "Uncomment Selection"
this.microhelp = "Uncomment the selected lines"
end on

on m_uncommentselection.destroy
call super::destroy
end on

type m_dash_web from menu within m_popup
end type

on m_dash_web.create
call super::create
this.text = "-"
end on

on m_dash_web.destroy
call super::destroy
end on

type m_websearch from menu within m_popup
end type

on m_websearch.create
call super::create
this.text = "Web Search"
this.microhelp = "Open a browser and search for the selected text"
end on

on m_websearch.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event

type m_gotowebsite from menu within m_popup
end type

on m_gotowebsite.create
call super::create
this.text = "Goto Website"
this.microhelp = "Open a browser and go to this website"
end on

on m_gotowebsite.destroy
call super::destroy
end on

event clicked;// call menu action function on window
ParentWindow.Dynamic Function wf_menu(this.ClassName())

end event