diff --git a/@GUI/init.m b/@GUI/init.m index 8c3f1c35b23babe33224357c7f89f574b3c48db0..44e552a4b906e45db77ea746081998316de12a51 100644 --- a/@GUI/init.m +++ b/@GUI/init.m @@ -185,7 +185,7 @@ object.setPBenable; object.default_prover = object.CVC_const; -object.settings = Settings(); +object.settings = TTSettings(); if isfield(object.Data.settings,'set') object.settings.setvalues(object.Data.settings); else diff --git a/@TTSettings/Settings.m b/@TTSettings/Settings.m new file mode 100644 index 0000000000000000000000000000000000000000..ec08cf168e5a7615e51a09010c27861c340c45cf --- /dev/null +++ b/@TTSettings/Settings.m @@ -0,0 +1,49 @@ +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +classdef Settings < handle + %UNTITLED Summary of this class goes here + % Detailed explanation goes here + + properties + % settings + pvs_includes = []; + counter_trials = []; + counter_range = []; + except = []; + + % gui elements + fig_width = 400; + fig_height = 300; + open = 0; + fig = []; + button_width = 60; + button_height = 30; + button_offset = 10; + title_height = 30; + label_height = 30; + label_width = 75; + text_offset = 10; + + include_text = []; + count_text = []; + range_text = []; + except_check = []; + end + + methods + + %% Settings + % constructor + % inputs: + % none + % outputs: + % object:Settings - created object + function object = Settings() + end + + + + end + +end + diff --git a/@TTSettings/apply_call.m b/@TTSettings/apply_call.m new file mode 100644 index 0000000000000000000000000000000000000000..c50cb3e0f2c80fe070658019d5e8a95afdb4fd67 --- /dev/null +++ b/@TTSettings/apply_call.m @@ -0,0 +1,15 @@ +%% apply_call +% callback for apply button, save the settings but do not close +% figure. +% inputs: +% object:Settings - current object +% src - source of the callback calling +% event - event that triggered the callback +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function err = apply_call(object,src,event) +object.save; +end + diff --git a/@TTSettings/cancel_call.m b/@TTSettings/cancel_call.m new file mode 100644 index 0000000000000000000000000000000000000000..ea47f52bea779dbf0adfa066dfe1a55721312667 --- /dev/null +++ b/@TTSettings/cancel_call.m @@ -0,0 +1,13 @@ +%% cancel_call +% callback for cancel button, cose figure don't save settings +% inputs: +% object:Settings - current object +% src - source of the callback calling +% event - event that triggered the callback +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = cancel_call(object,src,event) +object.close_fig([],[]); +end diff --git a/@TTSettings/close_fig.m b/@TTSettings/close_fig.m new file mode 100644 index 0000000000000000000000000000000000000000..d764de05b3d4e967dc429cc201b20faa4da5ff76 --- /dev/null +++ b/@TTSettings/close_fig.m @@ -0,0 +1,16 @@ +%% close_fig +% when close button is pressed delete the figure, allow a new +% one to be opened +% inputs: +% object:Settings - current object +% src - source of the callback calling +% event - event that triggered the callback +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = close_fig(object,src,event) +delete(object.fig); +object.open = 0; +end + diff --git a/@TTSettings/elipse_call.m b/@TTSettings/elipse_call.m new file mode 100644 index 0000000000000000000000000000000000000000..90b198acf7113d712113bafca11981bb8d1fee64 --- /dev/null +++ b/@TTSettings/elipse_call.m @@ -0,0 +1,30 @@ +%% elipse_call +% callback for when the elipses button is pressed, show file +% picker, update the textbox of selected files. +% inputs: +% object:Settings - current object +% src - source of the callback calling +% event - event that triggered the callback +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = elipse_call(object,src,event) +files = uigetfile('*.pvs','Select pvs files','MultiSelect','on'); +string = []; +if iscell(files) + for i = 1:size(files,2) + string = strcat(string,files(i)); + + if i ~= size(files,2) + string = strcat(string,', '); + + end + end + +else + string = files; +end +set(object.include_text,'String',char(string)); +end + diff --git a/@TTSettings/init.m b/@TTSettings/init.m new file mode 100644 index 0000000000000000000000000000000000000000..867e03af2eca132821e23ebd29413f760a593c07 --- /dev/null +++ b/@TTSettings/init.m @@ -0,0 +1,16 @@ +%% init +% +% inputs: +% object:Settings - current object +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = init(object) +% initialize the default values of the properties +object.pvs_includes = []; +object.counter_trials = 1000; +object.counter_range = 100; +object.except = 0; +end + diff --git a/@TTSettings/ok_call.m b/@TTSettings/ok_call.m new file mode 100644 index 0000000000000000000000000000000000000000..5b295452e9d3087497272f0cf28e77a120bdf214 --- /dev/null +++ b/@TTSettings/ok_call.m @@ -0,0 +1,17 @@ + +%% ok_call +% save settings and close figure +% inputs: +% object:Settings - current object +% src - source of the callback calling +% event - event that triggered the callback +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = ok_call(object,src,event) +if ~(object.save); + object.close_fig([],[]); +end + +end \ No newline at end of file diff --git a/@TTSettings/save.m b/@TTSettings/save.m new file mode 100644 index 0000000000000000000000000000000000000000..c8c9d1d274bc4c7d6222fc490775ff06b37f9de8 --- /dev/null +++ b/@TTSettings/save.m @@ -0,0 +1,38 @@ +%% save +% save the settigns to the object properties, check to ensure +% that user input validates. +% inputs: +% object:Settings - current object +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function err = save(object) +msg = [] ; +err = 0; +if isempty(str2num(get(object.count_text,'String'))) + msg = [msg get(object.count_text,'String') ' is not a valid number']; + err = 1; +else + object.counter_trials = str2num(get(object.count_text,'String')); +end + +if isempty(str2num(get(object.range_text,'String'))) + msg = [msg sprintf('\n') get(object.count_text,'String') ' is not a valid number']; + err = 1; +else + object.counter_range = str2num(get(object.range_text,'String')); +end +object.pvs_includes = get(object.include_text,'String'); + +if (get(object.except_check,'value') == get(object.except_check,'Max')) + object.except = true; +else + object.except = false; +end + +if err + msgbox(msg); +end +end + diff --git a/@TTSettings/setvalues.m b/@TTSettings/setvalues.m new file mode 100644 index 0000000000000000000000000000000000000000..7e5a7550cd8b8089c4e44bc0b22efa77ac5be67d --- /dev/null +++ b/@TTSettings/setvalues.m @@ -0,0 +1,20 @@ +%% setvalues +% update the object settings based on an inputed structure +% containing these desired values +% inputs: +% object:Settings - current object +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = setvalues(object,settings) + +object.pvs_includes = settings.inputs; +object.counter_trials = settings.count; +object.counter_range = settings.range; +if ~isfield(settings,'except') + settings.except = 0; +end +object.except = settings.except; +end + diff --git a/@TTSettings/show.m b/@TTSettings/show.m new file mode 100644 index 0000000000000000000000000000000000000000..c1c73119963aeaa831c1c17e870dbbcb3bab19a6 --- /dev/null +++ b/@TTSettings/show.m @@ -0,0 +1,159 @@ +%% show +% create the figure to show the gui used to change the settings +% inputs: +% object:Settings - current object +% outputs: +% none +% Author: Colin Eles elesc@mcmaster.ca +% Organization: McMaster Centre for Software Certification +function [] = show(object) +if (object.open) + figure(object.fig); +else + + object.fig = figure('units','pixels',... + 'position',[0 0 object.fig_width object.fig_height],... + 'menubar','none',... + 'name','Settings',... + 'numbertitle','off',... + 'resize','off',... + 'CloseRequestFcn',@(src,event)close_fig(object,src,event)); +end + +% Ok Button +uicontrol('style','push',... + 'units','pix',... + 'string','Ok',... + 'HorizontalAlign','left',... + 'Parent',object.fig,... + 'Position',[object.fig_width - object.button_width*3 - object.button_offset*3, object.button_offset, object.button_width, object.button_height],... + 'callback',@(src,event)ok_call(object,src,event)); + +% Cancel Button +uicontrol('style','push',... + 'units','pix',... + 'string','Cancel',... + 'HorizontalAlign','left',... + 'Parent',object.fig,... + 'Position',[object.fig_width - object.button_width*2 - object.button_offset*2, object.button_offset, object.button_width, object.button_height],... + 'callback',@(src,event)cancel_call(object,src,event)); + + +% Apply Button +uicontrol('style','push',... + 'units','pix',... + 'string','Apply',... + 'HorizontalAlign','left',... + 'Parent',object.fig,... + 'Position',[object.fig_width - object.button_width - object.button_offset, object.button_offset, object.button_width, object.button_height],... + 'callback',@(src,event)apply_call(object,src,event)); + +% main label +uicontrol('style','text',... + 'string','Table Tool Settings',... + 'HorizontalAlign','center',... + 'FontWeight','bold',... + 'Parent',object.fig,... + 'Position',[0, object.fig_height-object.text_offset-object.title_height, object.fig_width, object.title_height],... + 'BackgroundColor',get(object.fig,'Color')); + +panel_height = object.text_offset*7+object.label_height*4; +panel_width = object.fig_width-object.text_offset*2; +panel = uipanel('Title','PVS',... + 'visible','on',... + 'units','pix',... + 'BackgroundColor',get(object.fig,'Color'),... + 'Position',[object.text_offset,object.fig_height-object.text_offset-object.title_height-panel_height,panel_width,panel_height]); + + +% imports label +uicontrol('style','text',... + 'string','Imports:',... + 'HorizontalAlign','left',... + 'parent',panel,... + 'Position',[object.text_offset, panel_height-object.text_offset*3-object.label_height, object.label_width, object.label_height],... + 'BackgroundColor',get(object.fig,'Color')); + +elipse_width = 20; +% import text box +object.include_text = uicontrol('style','edit',... + 'units','pix',... + 'Parent',panel,... + 'String',object.pvs_includes,... + 'HorizontalAlign','center',... + 'BackgroundColor',get(object.fig,'Color'),... + 'Position',[object.text_offset+object.label_width, panel_height-object.text_offset*2-object.label_height, panel_width - (object.text_offset*3+object.label_width+elipse_width), object.label_height]); + +% elipsis button +uicontrol('style','push',... + 'units','pix',... + 'string','...',... + 'HorizontalAlign','left',... + 'Parent',panel,... + 'Position',[panel_width-elipse_width-object.text_offset, panel_height-object.text_offset*2-object.label_height, elipse_width, object.label_height],... + 'callback',@(src,event)elipse_call(object,src,event)); + + + +% count label +uicontrol('style','text',... + 'string','Test Count:',... + 'HorizontalAlign','left',... + 'parent',panel,... + 'Position',[object.text_offset, panel_height-object.text_offset*4-object.label_height*2, object.label_width, object.label_height],... + 'BackgroundColor',get(object.fig,'Color')); + +% count text box +object.count_text = uicontrol('style','edit',... + 'units','pix',... + 'Parent',panel,... + 'String',object.counter_trials,... + 'HorizontalAlign','center',... + 'BackgroundColor',get(object.fig,'Color'),... + 'Position',[object.text_offset+object.label_width, panel_height-object.text_offset*3-object.label_height*2, panel_width - (object.text_offset*2+object.label_width), object.label_height]); + + +% range label +uicontrol('style','text',... + 'string','Test Range:',... + 'HorizontalAlign','left',... + 'parent',panel,... + 'Position',[object.text_offset, panel_height-object.text_offset*5-object.label_height*3, object.label_width, object.label_height],... + 'BackgroundColor',get(object.fig,'Color')); + +% range text box +object.range_text = uicontrol('style','edit',... + 'units','pix',... + 'Parent',panel,... + 'String',object.counter_range,... + 'HorizontalAlign','center',... + 'BackgroundColor',get(object.fig,'Color'),... + 'Position',[object.text_offset+object.label_width, panel_height-object.text_offset*4-object.label_height*3, panel_width - (object.text_offset*2+object.label_width), object.label_height]); + +% range label +uicontrol('style','text',... + 'string','Exception Output',... + 'HorizontalAlign','left',... + 'parent',panel,... + 'Position',[object.text_offset, panel_height-object.text_offset*6-object.label_height*4, object.label_width, object.label_height],... + 'BackgroundColor',get(object.fig,'Color')); + + +% range text box +object.except_check = uicontrol('style','checkbox',... + 'units','pix',... + 'Parent',panel,... + 'HorizontalAlign','center',... + 'BackgroundColor',get(object.fig,'Color'),... + 'Position',[object.text_offset+object.label_width, panel_height-object.text_offset*5-object.label_height*4, panel_width - (object.text_offset*2+object.label_width), object.label_height]); + +if (object.except) + set(object.except_check,'value',get(object.except_check,'Max')); +else + set(object.except_check,'value',get(object.except_check,'Min')); + +end +object.open = 1; +end + +