Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katehighlight.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/document/katehighlight.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 797968b..0d2c283 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp | |||
@@ -640,89 +640,89 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) | |||
640 | lastChar = *s1; | 640 | lastChar = *s1; |
641 | s1++; | 641 | s1++; |
642 | z++; | 642 | z++; |
643 | } | 643 | } |
644 | 644 | ||
645 | //set "end of line"-properties | 645 | //set "end of line"-properties |
646 | textLine->setAttr(context->attr); | 646 | textLine->setAttr(context->attr); |
647 | 647 | ||
648 | //return new context | 648 | //return new context |
649 | return context->ctx; | 649 | return context->ctx; |
650 | } | 650 | } |
651 | 651 | ||
652 | KConfig *Highlight::getKConfig() { | 652 | KateConfig *Highlight::getKateConfig() { |
653 | KConfig *config; | 653 | KateConfig *config; |
654 | config=KGlobal::config(); | 654 | config=KGlobal::config(); |
655 | config->setGroup(iName + QString(" Highlight")); | 655 | config->setGroup(iName + QString(" Highlight")); |
656 | return config; | 656 | return config; |
657 | } | 657 | } |
658 | 658 | ||
659 | QString Highlight::getWildcards() { | 659 | QString Highlight::getWildcards() { |
660 | KConfig *config; | 660 | KateConfig *config; |
661 | 661 | ||
662 | config = getKConfig(); | 662 | config = getKateConfig(); |
663 | 663 | ||
664 | //if wildcards not yet in config, then use iWildCards as default | 664 | //if wildcards not yet in config, then use iWildCards as default |
665 | return config->readEntry("Wildcards", iWildcards); | 665 | return config->readEntry("Wildcards", iWildcards); |
666 | } | 666 | } |
667 | 667 | ||
668 | 668 | ||
669 | QString Highlight::getMimetypes() { | 669 | QString Highlight::getMimetypes() { |
670 | KConfig *config; | 670 | KateConfig *config; |
671 | 671 | ||
672 | config = getKConfig(); | 672 | config = getKateConfig(); |
673 | 673 | ||
674 | return config->readEntry("Mimetypes", iMimetypes); | 674 | return config->readEntry("Mimetypes", iMimetypes); |
675 | } | 675 | } |
676 | 676 | ||
677 | 677 | ||
678 | HlData *Highlight::getData() { | 678 | HlData *Highlight::getData() { |
679 | KConfig *config; | 679 | KateConfig *config; |
680 | HlData *hlData; | 680 | HlData *hlData; |
681 | 681 | ||
682 | config = getKConfig(); | 682 | config = getKateConfig(); |
683 | 683 | ||
684 | // iWildcards = config->readEntry("Wildcards"); | 684 | // iWildcards = config->readEntry("Wildcards"); |
685 | // iMimetypes = config->readEntry("Mimetypes"); | 685 | // iMimetypes = config->readEntry("Mimetypes"); |
686 | // hlData = new HlData(iWildcards,iMimetypes); | 686 | // hlData = new HlData(iWildcards,iMimetypes); |
687 | hlData = new HlData( | 687 | hlData = new HlData( |
688 | config->readEntry("Wildcards", iWildcards), | 688 | config->readEntry("Wildcards", iWildcards), |
689 | config->readEntry("Mimetypes", iMimetypes), | 689 | config->readEntry("Mimetypes", iMimetypes), |
690 | config->readEntry("Identifier", identifier)); | 690 | config->readEntry("Identifier", identifier)); |
691 | getItemDataList(hlData->itemDataList, config); | 691 | getItemDataList(hlData->itemDataList, config); |
692 | return hlData; | 692 | return hlData; |
693 | } | 693 | } |
694 | 694 | ||
695 | void Highlight::setData(HlData *hlData) { | 695 | void Highlight::setData(HlData *hlData) { |
696 | KConfig *config; | 696 | KateConfig *config; |
697 | 697 | ||
698 | config = getKConfig(); | 698 | config = getKateConfig(); |
699 | 699 | ||
700 | // iWildcards = hlData->wildcards; | 700 | // iWildcards = hlData->wildcards; |
701 | // iMimetypes = hlData->mimetypes; | 701 | // iMimetypes = hlData->mimetypes; |
702 | 702 | ||
703 | config->writeEntry("Wildcards",hlData->wildcards); | 703 | config->writeEntry("Wildcards",hlData->wildcards); |
704 | config->writeEntry("Mimetypes",hlData->mimetypes); | 704 | config->writeEntry("Mimetypes",hlData->mimetypes); |
705 | 705 | ||
706 | setItemDataList(hlData->itemDataList,config); | 706 | setItemDataList(hlData->itemDataList,config); |
707 | } | 707 | } |
708 | 708 | ||
709 | void Highlight::getItemDataList(ItemDataList &list) { | 709 | void Highlight::getItemDataList(ItemDataList &list) { |
710 | KConfig *config; | 710 | KateConfig *config; |
711 | 711 | ||
712 | config = getKConfig(); | 712 | config = getKateConfig(); |
713 | getItemDataList(list, config); | 713 | getItemDataList(list, config); |
714 | } | 714 | } |
715 | 715 | ||
716 | void Highlight::getItemDataList(ItemDataList &list, KConfig *config) { | 716 | void Highlight::getItemDataList(ItemDataList &list, KateConfig *config) { |
717 | ItemData *p; | 717 | ItemData *p; |
718 | QString s; | 718 | QString s; |
719 | QRgb col, selCol; | 719 | QRgb col, selCol; |
720 | 720 | ||
721 | list.clear(); | 721 | list.clear(); |
722 | //JW list.setAutoDelete(true); | 722 | //JW list.setAutoDelete(true); |
723 | createItemData(list); | 723 | createItemData(list); |
724 | 724 | ||
725 | for (p = list.first(); p != 0L; p = list.next()) { | 725 | for (p = list.first(); p != 0L; p = list.next()) { |
726 | s = config->readEntry(p->name); | 726 | s = config->readEntry(p->name); |
727 | if (!s.isEmpty()) { | 727 | if (!s.isEmpty()) { |
728 | sscanf(s.latin1(),"%d,%X,%X,%d,%d", &p->defStyle,&col,&selCol,&p->bold,&p->italic); | 728 | sscanf(s.latin1(),"%d,%X,%X,%d,%d", &p->defStyle,&col,&selCol,&p->bold,&p->italic); |
@@ -730,34 +730,34 @@ void Highlight::getItemDataList(ItemDataList &list, KConfig *config) { | |||
730 | p->selCol.setRgb(selCol); | 730 | p->selCol.setRgb(selCol); |
731 | } | 731 | } |
732 | } | 732 | } |
733 | } | 733 | } |
734 | 734 | ||
735 | /******************************************************************************************* | 735 | /******************************************************************************************* |
736 | Highlight - setItemDataList | 736 | Highlight - setItemDataList |
737 | saves the ItemData / attribute / style definitions to the apps configfile. | 737 | saves the ItemData / attribute / style definitions to the apps configfile. |
738 | Especially needed for user overridden values. | 738 | Especially needed for user overridden values. |
739 | 739 | ||
740 | * input: ItemDataList &list :reference to the list, whose | 740 | * input: ItemDataList &list :reference to the list, whose |
741 | * items should be saved | 741 | * items should be saved |
742 | * KConfig *config :Pointer KDE configuration | 742 | * KateConfig *config :Pointer KDE configuration |
743 | * class, which should be used | 743 | * class, which should be used |
744 | * as storage | 744 | * as storage |
745 | ************* | 745 | ************* |
746 | * output: none | 746 | * output: none |
747 | ************* | 747 | ************* |
748 | * return value: none | 748 | * return value: none |
749 | *******************************************************************************************/ | 749 | *******************************************************************************************/ |
750 | 750 | ||
751 | void Highlight::setItemDataList(ItemDataList &list, KConfig *config) { | 751 | void Highlight::setItemDataList(ItemDataList &list, KateConfig *config) { |
752 | ItemData *p; | 752 | ItemData *p; |
753 | QString s; | 753 | QString s; |
754 | 754 | ||
755 | for (p = list.first(); p != 0L; p = list.next()) { | 755 | for (p = list.first(); p != 0L; p = list.next()) { |
756 | s.sprintf("%d,%X,%X,%d,%d", | 756 | s.sprintf("%d,%X,%X,%d,%d", |
757 | p->defStyle,p->col.rgb(),p->selCol.rgb(),p->bold,p->italic); | 757 | p->defStyle,p->col.rgb(),p->selCol.rgb(),p->bold,p->italic); |
758 | config->writeEntry(p->name,s); | 758 | config->writeEntry(p->name,s); |
759 | } | 759 | } |
760 | } | 760 | } |
761 | 761 | ||
762 | 762 | ||
763 | /******************************************************************************************* | 763 | /******************************************************************************************* |
@@ -1257,25 +1257,25 @@ HlManager *HlManager::self() | |||
1257 | { | 1257 | { |
1258 | if ( !s_pSelf ) | 1258 | if ( !s_pSelf ) |
1259 | s_pSelf = new HlManager; | 1259 | s_pSelf = new HlManager; |
1260 | return s_pSelf; | 1260 | return s_pSelf; |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | Highlight *HlManager::getHl(int n) { | 1263 | Highlight *HlManager::getHl(int n) { |
1264 | if (n < 0 || n >= (int) hlList.count()) n = 0; | 1264 | if (n < 0 || n >= (int) hlList.count()) n = 0; |
1265 | return hlList.at(n); | 1265 | return hlList.at(n); |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | int HlManager::defaultHl() { | 1268 | int HlManager::defaultHl() { |
1269 | KConfig *config; | 1269 | KateConfig *config; |
1270 | config = KGlobal::config(); | 1270 | config = KGlobal::config(); |
1271 | config->setGroup("General Options"); | 1271 | config->setGroup("General Options"); |
1272 | 1272 | ||
1273 | #warning fixme return nameFind(config->readEntry("Highlight")); | 1273 | #warning fixme return nameFind(config->readEntry("Highlight")); |
1274 | 1274 | ||
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | 1277 | ||
1278 | int HlManager::nameFind(const QString &name) { | 1278 | int HlManager::nameFind(const QString &name) { |
1279 | int z; | 1279 | int z; |
1280 | 1280 | ||
1281 | for (z = hlList.count() - 1; z > 0; z--) { | 1281 | for (z = hlList.count() - 1; z > 0; z--) { |
@@ -1365,25 +1365,25 @@ QString HlManager::defaultStyleName(int n) | |||
1365 | names << i18n("Base-N Integer"); | 1365 | names << i18n("Base-N Integer"); |
1366 | names << i18n("Floating Point"); | 1366 | names << i18n("Floating Point"); |
1367 | names << i18n("Character"); | 1367 | names << i18n("Character"); |
1368 | names << i18n("String"); | 1368 | names << i18n("String"); |
1369 | names << i18n("Comment"); | 1369 | names << i18n("Comment"); |
1370 | names << i18n("Others"); | 1370 | names << i18n("Others"); |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | return names[n]; | 1373 | return names[n]; |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | void HlManager::getDefaults(ItemStyleList &list) { | 1376 | void HlManager::getDefaults(ItemStyleList &list) { |
1377 | KConfig *config; | 1377 | KateConfig *config; |
1378 | int z; | 1378 | int z; |
1379 | ItemStyle *i; | 1379 | ItemStyle *i; |
1380 | QString s; | 1380 | QString s; |
1381 | QRgb col, selCol; | 1381 | QRgb col, selCol; |
1382 | 1382 | ||
1383 | list.setAutoDelete(true); | 1383 | list.setAutoDelete(true); |
1384 | //ItemStyle(color, selected color, bold, italic) | 1384 | //ItemStyle(color, selected color, bold, italic) |
1385 | list.append(new ItemStyle(black,white,false,false)); //normal | 1385 | list.append(new ItemStyle(black,white,false,false)); //normal |
1386 | list.append(new ItemStyle(black,white,true,false)); //keyword | 1386 | list.append(new ItemStyle(black,white,true,false)); //keyword |
1387 | list.append(new ItemStyle(darkRed,white,false,false)); //datatype | 1387 | list.append(new ItemStyle(darkRed,white,false,false)); //datatype |
1388 | list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value | 1388 | list.append(new ItemStyle(blue,cyan,false,false)); //decimal/value |
1389 | list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n | 1389 | list.append(new ItemStyle(darkCyan,cyan,false,false)); //base n |
@@ -1401,25 +1401,25 @@ void HlManager::getDefaults(ItemStyleList &list) { | |||
1401 | i = list.at(z); | 1401 | i = list.at(z); |
1402 | s = config->readEntry(defaultStyleName(z)); | 1402 | s = config->readEntry(defaultStyleName(z)); |
1403 | if (!s.isEmpty()) { | 1403 | if (!s.isEmpty()) { |
1404 | sscanf(s.latin1(),"%X,%X,%d,%d",&col,&selCol,&i->bold,&i->italic); | 1404 | sscanf(s.latin1(),"%X,%X,%d,%d",&col,&selCol,&i->bold,&i->italic); |
1405 | i->col.setRgb(col); | 1405 | i->col.setRgb(col); |
1406 | i->selCol.setRgb(selCol); | 1406 | i->selCol.setRgb(selCol); |
1407 | } | 1407 | } |
1408 | } | 1408 | } |
1409 | */ | 1409 | */ |
1410 | } | 1410 | } |
1411 | 1411 | ||
1412 | void HlManager::setDefaults(ItemStyleList &list) { | 1412 | void HlManager::setDefaults(ItemStyleList &list) { |
1413 | KConfig *config; | 1413 | KateConfig *config; |
1414 | int z; | 1414 | int z; |
1415 | ItemStyle *i; | 1415 | ItemStyle *i; |
1416 | char s[64]; | 1416 | char s[64]; |
1417 | #warning fixme | 1417 | #warning fixme |
1418 | /* | 1418 | /* |
1419 | config = KateFactory::instance()->config(); | 1419 | config = KateFactory::instance()->config(); |
1420 | config->setGroup("Default Item Styles"); | 1420 | config->setGroup("Default Item Styles"); |
1421 | for (z = 0; z < defaultStyles(); z++) { | 1421 | for (z = 0; z < defaultStyles(); z++) { |
1422 | i = list.at(z); | 1422 | i = list.at(z); |
1423 | sprintf(s,"%X,%X,%d,%d",i->col.rgb(),i->selCol.rgb(),i->bold, i->italic); | 1423 | sprintf(s,"%X,%X,%d,%d",i->col.rgb(),i->selCol.rgb(),i->bold, i->italic); |
1424 | config->writeEntry(defaultStyleName(z),s); | 1424 | config->writeEntry(defaultStyleName(z),s); |
1425 | } | 1425 | } |