Skip to content

Commit

Permalink
remove autoreplacer
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Nov 22, 2024
1 parent 6ffe991 commit d3392a1
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions plugins/media/media.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ int CtrMediaPrevClickX = 0;
int CtrMediaPrevClickY = 0;
int CtrMediaPrevClickTime = 0;
char CtrMediaDoubleClick = 0;
ctr_size CtrMediaAutoReplaceRuleLen = 0;
int CtrMediaJumpHeightFactor = 100;
int CtrMediaControlMode = 0;
int CtrMediaRotation = 0;
Expand Down Expand Up @@ -93,14 +92,6 @@ struct CtrMediaTextRenderCacheItem {
typedef struct CtrMediaTextRenderCacheItem CtrMediaTextRenderCacheItem;
CtrMediaTextRenderCacheItem CtrMediaEdCache[400];

struct CtrMediaAutoReplaceRule {
char* word; char* replacement;
};

typedef struct CtrMediaAutoReplaceRule CtrMediaAutoReplaceRule;

CtrMediaAutoReplaceRule CtrMediaAutoReplaceRules[100];

struct MediaIMG {
double x; int h;
double y; int w;
Expand Down Expand Up @@ -235,7 +226,6 @@ void ctr_internal_media_clear_edcache() {
void ctr_internal_media_reset() {
controllableObject = NULL;
focusObject = NULL;
CtrMediaAutoReplaceRule* rule;
int i;
for(i = 0; i < IMGCount; i++) {
MediaIMG* mediaImage = &mediaIMGs[i];
Expand All @@ -244,13 +234,7 @@ void ctr_internal_media_reset() {
mediaImage->text = NULL;
}
}
for(i = 0; i < CtrMediaAutoReplaceRuleLen; i++) {
rule = &CtrMediaAutoReplaceRules[i];
ctr_heap_free(rule->word);
ctr_heap_free(rule->replacement);
}
ctr_internal_media_clear_edcache();
CtrMediaAutoReplaceRuleLen = 0;
IMGCount = 0;
AUDCount = 0;
CtrMediaJumpHeight = 0;
Expand All @@ -262,7 +246,6 @@ void ctr_internal_media_reset() {
CtrMediaPrevClickY = 0;
CtrMediaPrevClickTime = 0;
CtrMediaDoubleClick = 0;
CtrMediaAutoReplaceRuleLen = 0;
CtrMediaJumpHeightFactor = 100;
CtrMediaControlMode = 0;
CtrMediaRotation = 0;
Expand Down Expand Up @@ -629,22 +612,6 @@ ctr_object* ctr_media_left_top( ctr_object* myself, ctr_argument* argumentList )
return myself;
}

void ctr_internal_media_autoreplace(MediaIMG* image) {
int i, j;
char len;
CtrMediaAutoReplaceRule* rule;
for(i = 0; i < CtrMediaAutoReplaceRuleLen; i++) {
rule = &CtrMediaAutoReplaceRules[i];
len = strlen(rule->word);
if (strncmp(image->text+CtrMediaInputIndex-len, rule->word, len)==0) {
for (j = 0; j < len; j++) {
ctr_internal_media_textinsert(image, "\b");
}
ctr_internal_media_textinsert(image, rule->replacement);
}
}
}

void ctr_internal_cursormove(int x, int y) {
int offset = 0;
MediaIMG* text = ctr_internal_media_getfocusimage();
Expand Down Expand Up @@ -1726,7 +1693,6 @@ ctr_object* ctr_media_screen(ctr_object* myself, ctr_argument* argumentList) {
MediaIMG* focusImage = (MediaIMG*) focusObject->value.rvalue->ptr;
if (focusImage->editable) {
ctr_internal_media_textinsert(focusImage,event.text.text);
ctr_internal_media_autoreplace(focusImage);
ctr_internal_img_render_text(focusObject);
}
}
Expand Down

0 comments on commit d3392a1

Please sign in to comment.