@@ -8,9 +8,11 @@ import (
88 "fyne.io/fyne/v2"
99 "fyne.io/fyne/v2/canvas"
1010 "fyne.io/fyne/v2/dialog"
11+ "fyne.io/fyne/v2/widget"
1112 "image/color"
1213 "io"
1314 "log"
15+ url2 "net/url"
1416 "os"
1517 "path/filepath"
1618 "strconv"
@@ -19,12 +21,13 @@ import (
1921
2022var SavedProject struct {
2123 Options struct {
22- FlatMatrix bool
23- MatlabSaveFormat bool
24- MatrixCol int
25- MatrixRow int
26- SettingsSaved bool
27- OneHotEncodingSave bool
24+ FlatMatrix bool
25+ MatlabSaveFormat bool
26+ DotMFileWithVariable bool
27+ MatrixCol int
28+ MatrixRow int
29+ SettingsSaved bool
30+ OneHotEncodingSave bool
2831 }
2932 TempData struct {
3033 Saved bool
@@ -137,16 +140,24 @@ func matlabSaveCheckBoxFunction(b bool) {
137140 Options .MatlabSaveFormat = b
138141 if b {
139142 targetFileEntry .Enable ()
143+ dotMFileWithVariableCheck .Enable ()
140144 flatMatrixCheck .Disable ()
141145 flatMatrixCheck .SetChecked (false )
142146 Options .FlatMatrix = false
143147 Application .mainWindow .Canvas ().Refresh (Application .mainWindow .Content ())
144148 } else {
149+ dotMFileWithVariableCheck .Disable ()
145150 targetFileEntry .Disable ()
146151 flatMatrixCheck .Enable ()
147152 Application .mainWindow .Canvas ().Refresh (Application .mainWindow .Content ())
148153 }
149154}
155+
156+ func DotMFileWithVariableCheck (b bool ) {
157+ Options .DotMFileWithVariable = b
158+
159+ }
160+
150161func expertPNGOperation () {
151162 filename := "draw.png"
152163 if input .Text != "" {
@@ -206,6 +217,7 @@ func applyProjectSetting(withInitial bool) {
206217 colInput .Disable ()
207218 flatMatrixCheck .Disable ()
208219 matlabSaveCheck .Disable ()
220+ dotMFileWithVariableCheck .Disable ()
209221 oneHotEncodingSaveCheck .Disable ()
210222 Options .SettingsSaved = true
211223 if withInitial {
@@ -220,6 +232,7 @@ func resetProjectSetting() {
220232 colInput .Enable ()
221233 flatMatrixCheck .Enable ()
222234 matlabSaveCheck .Enable ()
235+ dotMFileWithVariableCheck .Enable ()
223236 oneHotEncodingSaveCheck .Enable ()
224237 counterLabel .SetText ("0" )
225238 Options .SettingsSaved = false
@@ -235,12 +248,29 @@ func resetProjectSetting() {
235248 }, Application .mainWindow ,
236249 )
237250}
251+
252+ func aboutBtn () {
253+ url , _ := url2 .Parse ("https://github.com/ehsan-torabi" )
254+ repoURL , _ := url2 .Parse ("https://github.com/ehsan-torabi/Draw2Matrix" )
255+ richText := widget .NewRichText (
256+ & widget.TextSegment {Text : "Programmed by : Ehsan Torabi Farsani" , Style : widget.RichTextStyle {}},
257+ & widget.TextSegment {Text : "\n For more details, visit our " , Style : widget.RichTextStyle {}},
258+ & widget.HyperlinkSegment {Text : "Github" , URL : url },
259+ & widget.TextSegment {Text : "\t " , Style : widget.RichTextStyle {}},
260+ & widget.HyperlinkSegment {Text : "Draw2Matrix Repository" , URL : repoURL },
261+ & widget.TextSegment {Text : "\n " , Style : widget.RichTextStyle {}},
262+ )
263+ dialog .NewCustom ("About" , "exit" , richText , Application .mainWindow ).Show ()
264+
265+ }
266+
238267func labelValidator (s string ) error {
239268 if len (s ) > 20 {
240269 return fmt .Errorf ("label too long" )
241270 }
242271 return nil
243272}
273+
244274func rowValidator (s string ) error {
245275 val , err := strconv .Atoi (s )
246276 if err != nil || val <= 0 {
@@ -296,6 +326,7 @@ func loadProjectFile(reader io.ReadCloser) error {
296326 colInput .Text = strconv .Itoa (Options .MatrixCol - 1 )
297327 oneHotEncodingSaveCheck .SetChecked (Options .OneHotEncodingSave )
298328 matlabSaveCheck .SetChecked (Options .MatlabSaveFormat )
329+ dotMFileWithVariableCheck .SetChecked (Options .DotMFileWithVariable )
299330 flatMatrixCheck .SetChecked (Options .FlatMatrix )
300331 Application .mainWindow .Content ().Refresh ()
301332 return nil
0 commit comments