Subversion Repositories DIN Is Noise

Rev

Rev 2229 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2229 jag 1
/*
2
* morse_code.h
2302 jag 3
* DIN Is Noise is copyright (c) 2006-2025 Jagannathan Sampath
1713 jag 4
* DIN Is Noise is released under GNU Public License 2.0
1528 jag 5
* For more information, please visit https://dinisnoise.org/
6
*/
7
 
8
#ifndef __MORSE_CODE
9
#define __MORSE_CODE
10
 
11
#include "command.h"
12
#include "multi_curve.h"
13
#include "curve_editor.h"
14
#include "listeners.h"
15
 
16
#include <map>
17
#include <string>
18
 
19
struct morse_code : command { // convert text to morse code to multi_curve to use as a pattern
20
 
21
  // international morse code
22
  std::map <char, std::string> code;
23
  int ncodes;
24
 
25
  // bezier curves for morse code primitives
26
  multi_curve dot, dash;
27
  multi_curve inner_space, letter_space, word_space;
28
 
29
  // morse code editor
30
  curve_editor ed;
31
  morse_code_listener lis;
32
 
33
  // generation
34
  int add_first_vertex;
35
  point<float> org;
36
  point<float> vi;
37
 
2229 jag 38
 
1528 jag 39
  morse_code (const std::string& ln, const std::string& sn);
40
  ~morse_code ();
41
  int load (const std::string& fname);
42
  int operator() (tokenizer& tz);
2229 jag 43
  int create_pattern (const std::string& text, float tox);
1528 jag 44
  void append (multi_curve& m, multi_curve& p);
45
  void scale_tox (multi_curve& m, float tox);
46
 
47
 
48
};
49
 
50
extern morse_code mc;
51
#endif
2229 jag 52
 
53
 
54